diff --git a/modules/visa/batch/batch_tools.php b/modules/visa/batch/batch_tools.php index f6acda9e2e966ad1586e2fdd76dd578ca9930985..dca368371892bf9aa595c5a921443a232c8bfbef 100755 --- a/modules/visa/batch/batch_tools.php +++ b/modules/visa/batch/batch_tools.php @@ -178,7 +178,7 @@ function Bt_createAttachment($aArgs = []) if (!empty($aArgs['table'])) { $table = $aArgs['table']; } else { - $table = 'res_letterbox'; + $table = 'res_attachments'; } if (!empty($aArgs['relation'])) { @@ -187,6 +187,12 @@ function Bt_createAttachment($aArgs = []) $relation = 1; } + if (!empty($aArgs['status'])) { + $status = $aArgs['status']; + } else { + $status = 'TRA'; + } + $dataValue = []; array_push($dataValue, ['column' => 'res_id_master', 'value' => $aArgs['res_id_master'], 'type' => 'integer']); array_push($dataValue, ['column' => 'title', 'value' => $aArgs['title'], 'type' => 'string']); @@ -201,13 +207,17 @@ function Bt_createAttachment($aArgs = []) array_push($dataValue, ['column' => 'relation', 'value' => $relation, 'type' => 'integer']); array_push($dataValue, ['column' => 'in_signature_book','value' => $inSignatureBook, 'type' => 'bool']); + if (!empty($aArgs['attachment_id_master'])) { + array_push($dataValue, ['column' => 'attachment_id_master','value' => $aArgs['attachment_id_master'], 'type' => 'integer']); + } + $allDatas = [ "encodedFile" => $aArgs['encodedFile'], "data" => $dataValue, "collId" => "letterbox_coll", "table" => $table, "fileFormat" => $aArgs['format'], - "status" => 'TRA' + "status" => $status ]; $opts = [