Task #02326: Suivi : possibilité de charger plusieurs documents

This commit is contained in:
sparkyx 2024-02-03 14:16:14 +01:00
parent cbdec27e33
commit df54871895
3 changed files with 27 additions and 4 deletions

View file

@ -451,7 +451,6 @@ class Document
* all the needed data are in $_FILES we don't increment the seq
* $_FILES : array containing by default $_FILES
* @param int $p_ag_id ACTION_GESTION.AG_ID
* @param int $agc_id ACTION_GESTION_COMMENT.AGC_ID
* @returns array of int DOCUMENT.D_ID (id of saved documents )
*
*/
@ -498,8 +497,12 @@ class Document
// insert into the table
$sql="insert into document (ag_id, d_lob,d_filename,d_mimetype,d_number,d_description)"
. " values ($1,$2,$3,$4,$5,$6) returning d_id";
$document_saved[]=$this->db->get_value($sql,
$document_id=$this->db->get_value($sql,
array($p_ag_id, $this->d_lob, $this->d_filename, $this->d_mimetype, 1, $this->d_description));
$document_saved[]=$document_id;
}
} /* end for */
$this->db->commit();

View file

@ -995,7 +995,8 @@ class Follow_Up
where agc_id = $4 "
, array(strip_tags($this->ag_description), $this->ag_description, $_SESSION[SESSION_KEY.'g_user'],
$this->ag_description_id));
$this->db->exec_sql("insert into action_comment_document(document_id,action_gestion_comment_id) values ($1,$2)",
[$document_id,$this->ag_description_id]);
}
$this->insert_operation();
$this->insert_action();

View file

@ -3,6 +3,7 @@
//This file is part of NOALYSS and is under GPL
//see licence.txt
$uniq=uniqid("tab",TRUE);
$dossier_id=Dossier::id();
?>
<div>
<?php
@ -345,7 +346,25 @@ function small(p_id_textarea){
echo $description->input();
echo '</div>';
}
// link to files to download
$aFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype
from action_comment_document
join document on (d_id=document_id) where action_gestion_comment_id=$1'
, array($this->ag_id));
if ( ! empty ($aFile)) {
echo '<div style="left:10%">';
echo _("Fichiers :");
foreach ($aFile as $file)
{
$url="export.php?".http_build_query(array("act"=>'RAW:document'
,"gDossier"=>$dossier_id
,"d_id"=>$file["d_id"]));
printf('<a class="print_line" href="%s">%s</a>',
$url,h($file['d_filename']));
}
echo '</div>';
}
//---------------------------------- Comment -----------------------------------------------------------------------
@ -391,7 +410,7 @@ function small(p_id_textarea){
echo '</span>';
}
}
$dossier_id=Dossier::id();
if ( count($acomment) > 0
&& Document_Option::can_add_comment($ag_id)
&& Document_Option::option_comment($this->dt_id) == "SOME_FIXED")