From a9a7443478334231f20c052fbbf4f22cefddfa32 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Mon, 8 Apr 2019 17:45:45 +0100 Subject: [PATCH] FIX retrieve document from signatory book --- modules/visa/batch/batch_tools.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/visa/batch/batch_tools.php b/modules/visa/batch/batch_tools.php index f6acda9e2e9..dca36837189 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 = [ -- GitLab