Supplementary documents for an operation, an operation can

have several attached documents
This commit is contained in:
sparkyx 2025-11-08 15:41:15 +01:00
parent b5f55a129a
commit 5b337881e5
8 changed files with 586 additions and 5 deletions

View file

@ -0,0 +1,68 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 22/10/23
/**
* @file
* @brief display form to add supplemental files to an operation
* var $gDossier (int) dossier
* var $jr_id (int) jrn.jr_id operation
* var $cn (Database) database cnx
* var $dgbox name of the dgbox
* var $div is the DIV
* supplement_div_list<?=$div?> list of files to update after uploading
*/
$dgbox=$http->request("dgbox");
$form_id="save_file{$div}";
$progress="progress{$div}";
$max_post_size=convert_ini_unit(ini_get("post_max_size"));
echo \HtmlInput::title_box(_("Ajout de fichier"), $dgbox);
?>
<div class="p-1">
<p>
<?=_("Ajouter des fichiers à cette opération")?>
</p>
<FORM method="POST" enctype="multipart/form-data" onsubmit="return false" id="<?=$form_id?>">
<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="<?= MAX_FILE_SIZE ?>">
<input type="hidden" id="post_max_size" name="post_max_size" value="<?= $max_post_size ?>">
<?=\HtmlInput::hidden("jr_id",$jr_id)?>
<?=\HtmlInput::hidden("gDossier",$gDossier)?>
<?=\HtmlInput::hidden("op","ledger")?>
<?=\HtmlInput::hidden("act","save_file")?>
<?=\HtmlInput::hidden("div",$div)?>
<?=\HtmlInput::hidden("dgbox",$dgbox)?>
<input type="FILE" name="document_supplemental[]" id="doc_sup" multiple>
<div id="feedback<?=$div?>"></div>
<ul class="aligned-block">
<li>
<input type='SUBMIT' class="smallbutton" name="upload" value="<?=_("Sauve")?>" onclick="return Supplement_Document.save_file('<?=$form_id?>');">
</li>
<li>
<?=\HtmlInput::button_close($dgbox)?>
</li>
</ul>
</FORM>
<progress style="height:auto;width: 100%;appearance: none;" id="progress_upload1b" max="100" value="0"></progress>
</div>

View file

@ -44,6 +44,7 @@ $a_tab['linked_operation_div']=array('id'=>'linked_operation_div'.$div,'label'=>
$a_tab['document_operation_div']=array('id'=>'document_operation_div'.$div,'label'=>_('Document').'('.$nb_document.')','display'=>'block');
$a_tab['linked_action_div']=array('id'=>'linked_action_div'.$div,'label'=>_('Actions Gestion').'('.count($a_followup).')','display'=>'none');
$a_tab['analytic_div']=array('id'=>'analytic_div'.$div,'label'=>_('Comptabilité Analytique'),'display'=>'none');
$a_tab['supplemental_doc_div']=array('id'=>'supplemental_doc_div'.$div,'label'=>_('Documents supplémentaires'),'display'=>'none');
//var $g_parameter \Noalyss_Parameter_Folder
global $g_parameter;
@ -293,9 +294,17 @@ echo '</div>';
?>
<?php
//------------------------------------------------
// Receipt
//------------------------------------------------
require_once NOALYSS_TEMPLATE.'/ledger_detail_file.php';
?>
<?php
//------------------------------------------------
// Receipt
//------------------------------------------------
require_once NOALYSS_TEMPLATE."/ledger_detail_sup_files.php";
?>
<div id="analytic_div<?php echo $div;?>" style="overflow:auto;display:<?php echo $a_tab['analytic_div']['display']?>">

View file

@ -0,0 +1,91 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 22/10/23
/**
* @file
* @brief show supplemental files and let you add one
@var $jr_id (int) JRN.JR_ID (inherited)
// @var $cn (Database) current conx
// @var $gDossier (int) folder id
*/
?>
<div id="supplemental_doc_div<?php echo $div;?>" class="myfieldset noprint" style="display:<?php echo $a_tab['supplemental_doc_div']['display']?>">
<div id="supplement_div_list<?=$div?>">
<?php
/**
* show existing supplemental files for this operation
*/
$q=new Jrn_Sup_Document_SQL($cn);
$a_row=$q->collect_objects(" where jr_id=$1 order by js_cbc_id", [$jr_id]);
$javascript=sprintf("Supplement_Document.input_file('%s','%s','%s')",
$gDossier,
$div,
$jr_id);
if ( count($a_row) > 0)
{
foreach ($a_row as $item) {
$export="export.php?";
$script="Supplement_Document.delete_document('$gDossier','$div','{$item->js_id}','$jr_id')";
$rowid=sprintf("row_js_%s_%s",$div,$item->js_id);
// @var $download (url) to send file
$download="export.php?". http_build_query(
[
"act"=>"RAW:suppl-document"
,"js_id"=>$item->js_id
,"gDossier"=>$gDossier
]);
?>
<div class="row" id="<?=$rowid?>">
<div class="col">
<a href="<?=$download?>" download> <?=$item->js_filename?></a>
</div>
<div class="col">
<?=$item->js_description?>
</div>
<div class="col">
<?=\Icon_Action::trash(uniqid("sdd"),$script)?>
</div>
</div>
<?php
}// end foreach $a_row
}// end if count
//download ALL files from this operation
$download="export.php?". http_build_query(
[
"act"=>"RAW:suppl-document"
,"js_id"=>0
,"gDossier"=>$gDossier
,'operation_id'=>$jr_id
]);
?>
<a href="<?=$download?>" download=""><?=_("Télécharger tous les documents")?>
</a>
</div>
<ul class="aligned-block">
<li>
<?=\HtmlInput::button_action(_("Ajout fichier"), $javascript);?>
</li>
</ul>
</div>