Merge branch 'devel' of gitlab.com:noalyss/noalyss into devel

This commit is contained in:
Dany wm 2024-01-28 17:37:55 +01:00
commit 0bb237105e
17 changed files with 200 additions and 69 deletions

View file

@ -44,7 +44,6 @@ input:focus {
font-style: italic;
background-color:transparent;
font-size: 100%;
font-weight: 0;
padding: 0px;
margin: 0px;
font-family: sans-serif;
@ -504,7 +503,6 @@ a.detail
font-family: 'openSansRegular';
text-decoration: underline;
display: block;
// color: #eb2208;
font-weight: normal;
background-color: transparent;
}
@ -2395,6 +2393,7 @@ td.selectedmenu {
{
margin-top:1px;
border:1px solid blue;
min-height: 5rem;
}
@media only screen and (max-width:850px) {

View file

@ -801,6 +801,8 @@ function view_history_account(p_value, dossier, p_exercice) {
onFailure: error_box,
onSuccess: function (req, xml) {
remove_waiting_box();
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div(popup);
success_box(req, xml);
$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
@ -840,6 +842,8 @@ function view_history_anc_account(p_value, dossier, p_exercice) {
onFailure: error_box,
onSuccess: function (req, xml) {
remove_waiting_box();
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div(popup);
$(idbox).innerHTML = req.responseText;
$(idbox).style.top = calcy(140 + (layer * 3)) + "px";
@ -874,6 +878,8 @@ function update_history_account(obj) {
onFailure: error_box,
onSuccess: function (req, xml) {
remove_waiting_box();
if (req.responseText === 'NOCONX') { reconnect();return;}
success_box(req, xml);
g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";
}
@ -915,6 +921,8 @@ function view_history_card(p_value, dossier, p_exercice) {
onFailure: error_box,
onSuccess: function (req, xml) {
remove_waiting_box();
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div(popup);
success_box(req, xml);
g(idbox).style.top = calcy(140 + (layer * 3)) + "px";
@ -947,6 +955,8 @@ function update_history_card(obj) {
parameters: querystring,
onFailure: error_box,
onSuccess: function (req, xml) {
if (req.responseText === 'NOCONX') { reconnect();return;}
remove_waiting_box();
success_box(req, xml);
g(obj.div).style.top = calcy(140 + (layer * 3)) + "px";

View file

@ -2430,6 +2430,7 @@ function set_preference(p_dossier) {
onFailure: ajax_misc_failure,
onSuccess: function (req) {
remove_waiting_box();
if (req.responseText === 'NOCONX') { reconnect();return;}
add_div({id: 'preference_div', drag: 1});
$('preference_div').innerHTML = req.responseText;
try

View file

@ -322,33 +322,32 @@ if ($sub_action == "save_action_st2")
{
$act = new Follow_Up($cn);
$act->fromArray($_POST);
try {
$act->d_id = 0;
$act->ag_id=$http->request("ag_id","number");
$act->md_id = $http->post('gen_doc','number',0);
try {
$act->d_id = 0;
$act->ag_id = $http->request("ag_id", "number");
$act->md_id = $http->post('gen_doc', 'number', 0);
$act->verify();
$sup_parameter=HtmlInput::array_to_string(["sc","sb","f_id","qcode"], $_REQUEST,"&");
// insert into action_gestion
$act->update();
$url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get()."&ac=".$http->request("ac").
$sup_parameter;
echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Action Sauvée').' : ' . $act->ag_ref) . '</a></p>';
$act->verify();
$sup_parameter = HtmlInput::array_to_string(["sc", "sb", "f_id", "qcode"], $_REQUEST, "&amp;");
// insert into action_gestion
$act->update();
Follow_Up::show_action_list($cn,$base);
$url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get()."&ac=".$http->request("ac").
$sup_parameter;
echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Action Sauvée').' : ' . $act->ag_ref) . '</a></p>';
} catch (Exception $e)
{
echo '<span class="notice">';
echo _("Erreur")." ".$e->getMessage();
echo '</span>';
$sub_action="add_action";
$error_id=$e->getCode();
record_log($e);
}
$url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get() . "&ac=" . $http->request("ac") .
$sup_parameter;
echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Action Sauvée') . ' : ' . $act->ag_ref) . '</a></p>';
Follow_Up::show_action_list($cn, $base);
$url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get() . "&ac=" . $http->request("ac") .
$sup_parameter;
echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Action Sauvée') . ' : ' . $act->ag_ref) . '</a></p>';
} catch (Exception $e) {
echo '<span class="notice">';
echo _("Erreur") . " " . $e->getMessage();
echo '</span>';
$sub_action = "add_action";
$error_id = $e->getCode();
record_log($e);
}
}
//--------------------------------------------------------------------------------
// Add an action

View file

@ -304,6 +304,18 @@ class Acc_Account_Ledger
}
return $this->name;
}
/*!
* \brief Return the type of a account
* \returns string ACT,ACTINV,CHA,CHAINV,CON,PAS,PRO
*/
function get_type()
{
$type=$this->db->get_value(
"select pcm_type from tmp_pcmn where
pcm_val=$1",array($this->id));
return $type;
}
/*!\brief check if the poste exist in the tmp_pcmn
*\return the number of line (normally 1 or 0)
*/
@ -446,6 +458,20 @@ class Acc_Account_Ledger
$rep="";
$type =$this->get_type();
// label warning if the saldo is incorrect
$label="";
if (in_array($type,array('CHA','ACT','PASINV','PROINV')) && $tot_deb<$tot_cred)
{
$label.=_("Solde créditeur au lieu de débiteur").'<span class="icon">&#xe80e;</span>';
}
if (in_array($type,array('PRO','PAS','ACTINV','CHAINV')) && $tot_deb>$tot_cred)
{
$label.=_("Solde débiteur au lieu de créditeur")." ".'<span class="icon">&#xe80e;</span>';
}
echo '<span class="notice">'.$label.'</span>';
if ( $from_div == 1)
echo "<TABLE id=\"tbpopup\" class=\"resultfooter\" style=\"border-collapse:separate;margin:1%;width:98%;\">";
@ -570,6 +596,8 @@ class Acc_Account_Ledger
echo '</tbody>';
echo "</table>";
if ( DEBUGNOALYSS>1) echo \Noalyss\Dbg::hidden_info("variable", get_defined_vars());
if ( DEBUGNOALYSS>1) echo \Noalyss\Dbg::hidden_info("this", $this);
return;
}

View file

@ -449,7 +449,10 @@ class Document
/**
* @brief upload a file into document
* all the needed data are in $_FILES we don't increment the seq
* @param $p_file : array containing by default $_FILES
* $_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 )
*
*/
function upload($p_ag_id)
@ -463,6 +466,10 @@ class Document
// Start Transaction
$this->db->start();
$name=$_FILES['file_upload']['name'];
$document_saved=array();
$http=new HttpInput();
$aDescription=$http->post("input_desc","array",array());
$description="";
for ($i=0; $i<sizeof($name); $i++)
{
$new_name=tempnam($_ENV['TMP'], 'doc_');
@ -484,15 +491,19 @@ class Document
$this->d_lob=$oid;
$this->d_filename=$_FILES['file_upload']['name'][$i];
$this->d_mimetype=$_FILES['file_upload']['type'][$i];
$this->d_description=strip_tags($_POST['input_desc'][$i]);
if ( isset($aDescription[$i])) {
$description=strip_tags($aDescription[$i]??"");
}
$this->d_description=$description;
// 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)";
$this->db->exec_sql($sql,
. " values ($1,$2,$3,$4,$5,$6) returning d_id";
$document_saved[]=$this->db->get_value($sql,
array($p_ag_id, $this->d_lob, $this->d_filename, $this->d_mimetype, 1, $this->d_description));
}
} /* end for */
$this->db->commit();
return $document_saved;
}
/**
@ -540,8 +551,19 @@ class Document
$this->db->start();
$ret=$this->db->exec_sql(
"select d_id,d_lob,d_filename,d_mimetype from document where d_id=$1", [$this->d_id]);
if (Database::num_row($ret)==0)
{
// send it to stdout
ini_set('zlib.output_compression', 'Off');
header("Pragma: public");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: must-revalidate");
header('Content-type: text');
header('Content-Disposition: attachment;filename="vide.txt"', FALSE);
header("Accept-Ranges: bytes");
echo "VIDE-EMPTY";
return;
}
$row=Database::fetch_array($ret, 0);
@ -550,7 +572,7 @@ class Document
$this->db->lo_export($row['d_lob'], $tmp);
$this->d_mimetype=$row['d_mimetype'];
$this->d_filename=$row['d_filename'];
$file=fopen($tmp, 'r');
// send it to stdout
ini_set('zlib.output_compression', 'Off');
header("Pragma: public");
@ -560,7 +582,6 @@ class Document
header('Content-type: '.$this->d_mimetype);
header('Content-Disposition: attachment;filename="'.$this->d_filename.'"', FALSE);
header("Accept-Ranges: bytes");
$file=fopen($tmp, 'r');
while (!feof($file))
{
echo fread($file, 8192);
@ -568,7 +589,6 @@ class Document
fclose($file);
unlink($tmp);
$this->db->commit();
}

View file

@ -1366,9 +1366,9 @@ class Fiche
/* Filter on the default year */
if ( $g_parameter->MY_REPORT == 'N') {
$amount=$tiers->get_solde_detail($filter_year);
} else {
$amount = $tiers->get_solde_detail();
} else {
$amount=$tiers->get_solde_detail($filter_year);
}
/* skip the tiers without operation */

View file

@ -416,6 +416,7 @@ class Follow_Up
/* for new files */
$upload=new IFile();
$upload->name="file_upload[]";
$upload->set_multiple(true);
$upload->setAlertOnSize(true);
$upload->readOnly=$readonly;
$upload->value="";
@ -948,7 +949,7 @@ class Follow_Up
}
// upload documents
$doc=new Document($this->db);
$doc->upload($this->ag_id);
$document_saved=$doc->upload($this->ag_id);
/* save action details */
$http=new HttpInput();
@ -966,8 +967,15 @@ class Follow_Up
if (trim(strip_tags($this->ag_comment??"")) !='')
{
$notag_comment=strip_tags($this->ag_comment);
$this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment,agc_comment_raw) values ($1,$2,$3,$4)"
$action_comment_id=$this->db->get_value("insert into action_gestion_comment (ag_id,tech_user,agc_comment,agc_comment_raw) values ($1,$2,$3,$4) returning agc_id"
, array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $notag_comment,$this->ag_comment));
// saved also documents for this comment
if ( ! empty ($document_saved)) {
foreach ($document_saved as $document_id) {
$this->db->exec_sql("insert into action_comment_document(document_id,action_gestion_comment_id) values ($1,$2)",
[$document_id,$action_comment_id]);
}
}
}
if (trim(strip_tags($this->ag_description??""))!='' )
{

View file

@ -123,7 +123,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
if (!defined("SYSINFO_DISPLAY")) {
define("SYSINFO_DISPLAY", TRUE);
}
define("DBVERSION", 192);
define("DBVERSION", 193);
define("MONO_DATABASE", 25);
define("DBVERSIONREPO", 20);
define('NOTFOUND', '--not found--');

View file

@ -26,7 +26,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
$http=new HttpInput();
$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
$low_action = $http->request("sb","string","list");
/** \file
* \brief Called from the module "Gestion" to manage the customer
*/

View file

@ -909,7 +909,7 @@ function ajax_disconnected($p_div)
echo HtmlInput::title_box(_("Déconnecté"), $p_div);
echo h2(_('Données non disponibles'), 'class="error" ');
echo h2(_('Veuillez vous reconnecter soit dans une autre fenêtre soit '
. ' en cliquant sur le lien'), 'class="error"');
. ' en cliquant sur le bouton'), 'class="error"');
// Reload button
$reload=new IButton("reload");
$reload->value=_("Se connecter");
@ -918,7 +918,7 @@ function ajax_disconnected($p_div)
// Link to log in another tab
echo '<p style="text-align:center">';
echo $reload->input();
echo HtmlInput::button_close($p_div);
echo HtmlInput::button_close($p_div,'button');
echo '</p>';

View file

@ -79,6 +79,8 @@ EOF;
<pre><?= print_r($_GET) ?></pre>
$_REQUEST
<pre><?= print_r($_REQUEST) ?></pre>
$_FILES
<pre><?= print_r($_FILES) ?></pre>
<?= \HtmlInput::button_hide($id) ?>
</div>
<input type="button" onclick="document.getElementById('<?= $id ?>').show();" value="Show request">

View file

@ -444,10 +444,11 @@ class HtmlInput
* @see add_div modify_operation
* @param $div_name is the name of the div to remove
*/
static function button_close($div_name)
static function button_close($div_name,$class='smallbutton')
{
$a=new IButton('Fermer');
$a->label=_("Fermer");
$a->class=$class;
$a->javascript="removeDiv('".$div_name."')";
$html=$a->input();

View file

@ -31,10 +31,23 @@ class IFile extends HtmlInput
{
// if true , the size is tested and a box is displaid
private $alert_on_size;
private $multiple ; // false by default, if true allow to select several files
function __construct($p_name = "", $p_value = "", $p_id = "")
{
parent::__construct($p_name, $p_value, $p_id);
$this->alert_on_size=false;
$this->multiple=false;
}
public function get_multiple(): bool
{
return $this->multiple;
}
public function set_multiple(bool $multiple): IFile
{
$this->multiple = $multiple;
return $this;
}
/**
@ -61,7 +74,11 @@ class IFile extends HtmlInput
$this->value=($p_value==null)?$this->value:$p_value;
if ( $this->readOnly==true) return $this->display();
if ($this->id=="") $this->id=uniqid("file_");
$r=sprintf('<INPUT class="inp" TYPE="file" name="%s" id="%s" value="%s">',
$multiple="";
if ( $this->multiple) $multiple=" multiple ";
$r=sprintf('<INPUT class="inp" %s TYPE="file" name="%s" id="%s" value="%s">',
$multiple,
$this->name,
$this->id,
$this->value);

View file

@ -0,0 +1,10 @@
begin;
create table action_comment_document (acd_id bigint generated by default as identity primary key
, document_id bigint references document(d_id) on delete cascade on update cascade,
action_gestion_comment_id bigint references action_gestion_comment(agc_id) on delete cascade on update cascade);
alter table action_comment_document
add constraint action_comment_document_un
unique (document_id, action_gestion_comment_id);
insert into version (val,v_description) values (193,' 2332: Suivi : ajout fichier lié aux commentaires');
commit;

View file

@ -377,6 +377,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")
@ -395,7 +396,7 @@ function small(p_id_textarea){
$js=Icon_Action::trash("accom".$acomment[$c]['agc_id'], $rmComment);
$comment= h($m_desc.' '.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".
$acomment[$c]['str_agc_date'].')').$js.
'<div class="nicEdit-main field_follow_up" style="margin-left:5%;margin-bottom:2rem;width:90%" id="com'.$acomment[$c]['agc_id'].'"> '.
'<div class="nicEdit-main field_follow_up" style="margin-left:5%;margin-bottom:auto;width:90%" id="com'.$acomment[$c]['agc_id'].'"> '.
" ".$acomment[$c]['agc_comment_raw'].'</div>'
;
@ -414,10 +415,30 @@ function small(p_id_textarea){
Dossier::id().',0)" >\1</a>',$comment);
echo '<p></p>';
echo $comment;
// 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( $acomment[$c]['agc_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>';
}
} // end for
if ( $has_description && $p_view == 'UPD' && Document_Option::can_add_comment($ag_id)) {
echo '<span class="noprint">';
echo '<div style="margin-left:5%">';
echo '<div style="margin-left:5%;margin-top:2.5rem">';
echo $desc->input();
echo '</div>';
}
@ -451,8 +472,26 @@ if ( $this->ag_id > 0 && Document_Option::is_enable_operation_detail($this->dt_i
**********************************************************************************************************************/
?>
<div style="clear:both"></div>
<div style="clear:both"></div>
<?php if ($p_view != 'READ') : ?>
<div class="noprint">
<h3 >Fichiers à ajouter: </h3>
<ol id='add_file' >
<li>
<?php echo $upload->input();
?>
<?php
$js="document.getElementById('add_file').removeChild(this.parentNode)";
echo Icon_Action::trash(uniqid(),$js);
?>
</li>
</ol>
<span >
<input type="button" class="smallbutton" onclick="addFiles();" value="<?php echo _("Ajouter un fichier")?>">
</span>
</div>
<?php endif;?>
<div id="div_action_attached_doc">
@ -480,7 +519,19 @@ endif; ?>
**********************************************************************************************************************/
?>
</div>
<div class="print">
<div id="icon_show_file_div_id<?=$uniq?>">
<?php
/** Start Block Document **/
printf ("Voir tous les fichiers");
echo \Icon_Action::show_icon(uniqid(), "$('all_attached_files_div{$uniq}').show();$('icon_show_file_div_id{$uniq}').hide()");
?>
</div>
<div class="print" style="display: none" id="all_attached_files_div<?=$uniq?>">
<?php
echo "Cacher les fichiers";
echo \Icon_Action::hide_icon(uniqid(), "$('all_attached_files_div{$uniq}').hide();$('icon_show_file_div_id{$uniq}').show()")
?>
<table>
<?php
for ($i=0;$i<sizeof($aAttachedFile);$i++) :
@ -524,6 +575,9 @@ endfor;
?>
</table>
</div>
<div>
<?php if ( ! empty ($aAttachedFile)) :
/*** Propose to download all document in only one step */
$url="export.php?".http_build_query([
@ -542,7 +596,7 @@ function addFiles() {
try {
docAdded=document.getElementById('add_file');
new_element=document.createElement('li');
new_element.innerHTML='<input class="inp" type="file" value="" name="file_upload[]"/><label>Description</label> <input type="input" class="input_text" name="input_desc[]" >';
new_element.innerHTML='<input class="inp" type="file" value="" multiple name="file_upload[]"/>';
new_element.innerHTML+='<span id="<?=uniqid("file")?>" onclick="document.getElementById(\'add_file\').removeChild(this.parentNode)" class="icon">&#xe80f;</span>';
@ -553,26 +607,7 @@ try {
catch(exception) { alert('<?php echo j(_('Je ne peux pas ajouter de fichier'))?>'); alert(exception.message);}
}
</script>
<?php if ($p_view != 'READ') : ?>
<div class="noprint">
<h3 >Fichiers à ajouter: </h3>
<ol id='add_file' >
<li>
<?php echo $upload->input();
?>
<label><?php echo _('Description')?></label>
<input type="input" class="input_text" name="input_desc[]" >
<?php
$js="document.getElementById('add_file').removeChild(this.parentNode)";
echo Icon_Action::trash(uniqid(),$js);
?>
</li>
</ol>
<span >
<input type="button" class="smallbutton" onclick="addFiles();" value="<?php echo _("Ajouter un fichier")?>">
</span>
</div>
<?php endif;?>
</div>
<?php if ($p_view != 'NEW') : ?>
Document créé le <?php echo $this->ag_timestamp ?> par <?php echo $this->ag_owner?>

View file

@ -0,0 +1 @@