douyu0852 2019-04-23 07:34
浏览 79

[vtiger] [Webservice]无法在vtigercrm中的Documents Module中创建文档,在执行请求的操作时使用webservice Database错误

I am working on web services of vtigercrm, I want to create a document in the document module in vtigercrm 6.5 using web service, how I can do create a new document in document module in vtigercrm?

I create one PHP file, where I made a form for creating an organization in along with i also want to create document too. so that i set also file uploading input tag in that form, and i post all data to the url.php, where i setting the array and passing params to the

$params = array(

     'notes_title'=>$accountname,
     'filesize' => $filesize,
     'filetype' => $filetype,
     'filename'=>$filename,
     'assigned_user_id'=>$assigned_user);

and encode them

$objectJson = Zend_JSON::encode($params);

set module name

$moduleName = 'Documents';

set params and operation

 $params = array("sessionName"=>$sessionId, "operation"=>'create', "element"=>$objectJson, "elementType"=>$moduleName);

$httpc->post($endpointUrl.$urlArgs, $params, true); $response = $httpc->currentResponse();

but here when ever i print $response, i will get this error messege

  [body] => {"success":false,"error":{"code":"DATABASE_QUERY_ERROR","message":"Database error while performing requested operation"}}

continue code :

   $jsonResponse = Zend_JSON::decode($response['body']);
   $savedObject = $jsonResponse['result'];

here i write this code for geting name and size and type of a file.

if($_FILES['fileToUpload']['name'] != ''){
$errCode=$_FILES['fileToUpload']['error'];
    if($errCode == 0){
        foreach($_FILES as $fileindex => $files)
        {
            if($files['name'] != '' && $files['size'] > 0){
                $filename = $_FILES['fileToUpload']['name'];
                $filename = from_html(preg_replace('/\s+/', '_', $filename));
                $filetype = $_FILES['fileToUpload']['type'];
                $filesize = (string)$_FILES['fileToUpload']['size'];
                $filelocationtype = 'I';
                $binFile = sanitizeUploadFileName($filename, $upload_badext);
                $filename = ltrim(basename(" ".$binFile)); //allowed filename like UTF-8 characters
            }
        }

    }
}

when ever i run the code into my vtigercrm i got the failed arror msg into my log

Query Failed:UPDATE vtiger_notes SET filename = ? ,filesize = ?, filetype = ? , filelocationtype = ? , filedownloadcount = ? WHERE notesid = ?::->[1048]Column 'filesize' cannot be null

i think the error shows Column 'filesize' cannot be null

But above in my code i already get the size of an file and i already passed into query. then why i got this error.

i tried so many times, any one can help me out from this.

Thank you In Advance, Waiting for positive reply.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败