Note on operations are in the detail of the operation

This commit is contained in:
sparkyx 2025-10-26 16:58:10 +01:00
parent c34a5eda05
commit a54af9e09c
7 changed files with 121 additions and 84 deletions

View file

@ -1278,7 +1278,7 @@ function op_save(obj) {
var divid = obj.whatdiv.value;
queryString ["act"] = "save";
queryString ["op"] = "ledger";
queryString ["jr_note"]=encodeURI(tinyMCE.get("jrn_note"+divid).getContent());
waiting_box();
/*
* Operation detail is in a new window
@ -1330,6 +1330,7 @@ function op_save(obj) {
id$(divid).innerHTML = unescape(getNodeText(html[0]));
id$(divid).innerHTML.evalScripts();
remove_waiting_box();
noalyss.refresh_note(jr_id,obj.gDossier.value);
} catch (e) {
console.error("D1. op_save")
alert_box("1038" + e.message)

View file

@ -42,7 +42,18 @@ var g_enable_tinymce=true;
*/
if ( ! window.crypto.randomUUID) {
console.info("too old browser: implement function randomUUID")
g_enable_tinymce=false;
window.crypto.randomUUID=function()
{
let myArray = new Uint32Array(4);
crypto.getRandomValues(myArray);
let result="";let and="";
for(a of myArray)
{
result+=and.a;
and="-";
}
return result;
}
}

View file

@ -412,8 +412,17 @@ switch ($action) {
from jrnx join jrn on (j_grpt=jr_grpt_id)
where jr_id=$1)
', array($jr_id));
//------------------------------------------------
// Save note
//------------------------------------------------
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
$acc_operation_note->setOperation_id($jr_id);
$acc_operation_note->setNote(decodeURI($http->post("jr_note",'raw')??""));
$acc_operation_note->save();
$cn->commit();
break;
$rapt = $http->post('rapt');
if ($g_parameter->MY_UPDLAB == 'Y' && isset ($_POST['j_id'])) {
$a_rowid = $http->post("j_id");
@ -555,60 +564,60 @@ switch ($action) {
break;
//------------------------------------------------
// Display note
//------------------------------------------------
case 'note_input':
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
try {
$ctl="box_input_note".$div;
$html=HtmlInput::title_box(_("Note"), $ctl);
$textarea= Acc_Operation_Note::build_textarea($div);
if ( $http->get('tinymce')=='true')
$textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_html");
else {
$textarea->set_enrichText('plain');
$textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_text");
}
// start FORM
$html.=sprintf('<form id="form_input_note%s" onsubmit="noalyss.save_note(this);return false;">',
$div);
$html.=$textarea->input();
$html.=HtmlInput::hidden('gDossier', $gDossier);
$html.=HtmlInput::hidden('div', $div);
$html.=HtmlInput::hidden('jr_id', $jr_id);
$html.=HtmlInput::hidden('act', 'note_save');
$html.=HtmlInput::submit("save", _("Sauve"));
$html.=HtmlInput::hidden("input_html", $textarea->id);
$html.=HtmlInput::button_close($ctl);
// end form
$html.="</form>";
} catch (Exception $exc) {
echo $exc->getTraceAsString();
}
break;
case 'note_save':
//------------------------------------------------
// save note
//------------------------------------------------
/**
* received parameters
* - gDossier
* - div
* - jr_id
* - note_html
*/
$ctl="box_input_note".$div;
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
$acc_operation_note->setOperation_id($jr_id);
$acc_operation_note->setNote($http->post("note_html",'raw'));
$acc_operation_note->save();
$html=$http->post("note_html","raw");
////------------------------------------------------
//// Display note
////------------------------------------------------
// case 'note_input':
// $acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
// try {
// $ctl="box_input_note".$div;
// $html=HtmlInput::title_box(_("Note"), $ctl);
// $textarea= Acc_Operation_Note::build_textarea($div);
// if ( $http->get('tinymce')=='true')
// $textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_html");
// else {
// $textarea->set_enrichText('plain');
// $textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_text");
// }
//
// // start FORM
// $html.=sprintf('<form id="form_input_note%s" onsubmit="noalyss.save_note(this);return false;">',
// $div);
//
// $html.=$textarea->input();
//
// $html.=HtmlInput::hidden('gDossier', $gDossier);
// $html.=HtmlInput::hidden('div', $div);
// $html.=HtmlInput::hidden('jr_id', $jr_id);
// $html.=HtmlInput::hidden('act', 'note_save');
// $html.=HtmlInput::submit("save", _("Sauve"));
// $html.=HtmlInput::hidden("input_html", $textarea->id);
// $html.=HtmlInput::button_close($ctl);
// // end form
// $html.="</form>";
// } catch (Exception $exc) {
// echo $exc->getTraceAsString();
//}
//
// break;
// case 'note_save':
////------------------------------------------------
//// save note
////------------------------------------------------
//
// /**
// * received parameters
// * - gDossier
// * - div
// * - jr_id
// * - note_html
// */
// $ctl="box_input_note".$div;
// $acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
// $acc_operation_note->setOperation_id($jr_id);
// $acc_operation_note->setNote($http->post("note_html",'raw'));
// $acc_operation_note->save();
// $html=$http->post("note_html","raw");
break;
case 'note_refresh':
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);

View file

@ -109,14 +109,16 @@ $dossier_id=Dossier::id();
<table style="width:99%;height:8rem;vertical-align:top;">
<tr style="height: 5%">
<td style="text-align:center;vertical-align: top">
<button onclick="noalyss.input_note('<?=$dossier_id?>','<?=$jr_id?>','<?=$div?>');return false;" class="smallbutton">
<?=_("Note")?>
</button>
</td></tr>
<tr>
<td id="note_html<?=$div?>" style="text-align:center;vertical-align: top">
<?=$obj->det->note_html?>
<?php
$inote = new ITextarea('jrn_note');
$inote->set_enrichText("minimal");
$inote->id="jrn_note{$div}";
$inote->style=' class="itextarea" style="width:90%;height:100%;"';
$inote->value = $obj->det->note_html;
$inote->heigh=200;
echo $inote->input();
?>
</td>
</tr>
<tr>

View file

@ -82,9 +82,16 @@ echo td(_('Pièce')).td($itext->input());
<table style="width:99%;height:8rem;vertical-align:top;">
<tr style="height: 5%">
<td style="text-align:center;vertical-align: top">
<button onclick="noalyss.input_note('<?=$dossier_id?>','<?=$jr_id?>','<?=$div?>');return false;" class="smallbutton">
<?=_("Note")?>
</button>
<?php
$inote = new ITextarea('jrn_note');
$inote->set_enrichText("minimal");
$inote->id="jrn_note{$div}";
$inote->style=' class="itextarea" style="width:90%;height:100%;"';
$inote->value = $obj->det->note_html;
$inote->heigh=200;
echo $inote->input();
?>
</td>
</tr>
<tr>

View file

@ -78,14 +78,16 @@ $dossier_id=Dossier::id();
<table style="width:99%;height:8rem;vertical-align:top;">
<tr style="height: 5%">
<td style="text-align:center;vertical-align: top">
<button onclick="noalyss.input_note('<?=$dossier_id?>','<?=$jr_id?>','<?=$div?>');return false;" class="smallbutton">
<?=_("Note")?>
</button>
</td></tr>
<tr>
<td id="note_html<?=$div?>" style="text-align:center;vertical-align: top">
<?=$obj->det->note_html?>
</td>
<?php
$inote = new ITextarea('jrn_note');
$inote->set_enrichText("minimal");
$inote->id="jrn_note{$div}";
$inote->style=' class="itextarea" style="width:90%;height:100%;"';
$inote->value = $obj->det->note_html;
$inote->heigh=200;
echo $inote->input();
?>
</tr>
<tr>
<td>

View file

@ -105,6 +105,7 @@ $str_anc = "";
$ipaid = new ICheckBox("ipaid", 'paid');
$ipaid->selected = ($obj->det->jr_rapt == 'paid');
echo $ipaid->input();
if ( DEBUGNOALYSS > 0) echo \Noalyss\Dbg::hidden_info("obj", $obj);
?>
</td>
</tr>
@ -113,17 +114,21 @@ $str_anc = "";
</td>
<td style="width:50%;height:100%;vertical-align:top;text-align: center">
<table style="width:99%;height:8rem;vertical-align:top;">
<tr style="height: 5%">
<tr style="height: 5rem">
<td style="text-align:center;vertical-align: top">
<button onclick="noalyss.input_note('<?=$dossier_id?>','<?=$jr_id?>','<?=$div?>');return false;" class="smallbutton">
<?=_("Note")?>
</button>
</td>
</tr>
<tr>
<td id="note_html<?=$div?>" style="text-align:center;vertical-align: top">
<?=$obj->det->note_html?>
<?php
$inote = new ITextarea('jrn_note');
$inote->set_enrichText("minimal");
$inote->id="jrn_note{$div}";
$inote->style=' class="itextarea" style="width:90%;height:100%;"';
$inote->value = $obj->det->note_html;
$inote->heigh=200;
echo $inote->input();
?>
</td>
</tr>
<tr>
<td>