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

View file

@ -42,7 +42,18 @@ var g_enable_tinymce=true;
*/ */
if ( ! window.crypto.randomUUID) { if ( ! window.crypto.randomUUID) {
console.info("too old browser: implement function 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) from jrnx join jrn on (j_grpt=jr_grpt_id)
where jr_id=$1) where jr_id=$1)
', array($jr_id)); ', 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'); $rapt = $http->post('rapt');
if ($g_parameter->MY_UPDLAB == 'Y' && isset ($_POST['j_id'])) { if ($g_parameter->MY_UPDLAB == 'Y' && isset ($_POST['j_id'])) {
$a_rowid = $http->post("j_id"); $a_rowid = $http->post("j_id");
@ -555,60 +564,60 @@ switch ($action) {
break; break;
//------------------------------------------------ ////------------------------------------------------
// Display note //// Display note
//------------------------------------------------ ////------------------------------------------------
case 'note_input': // case 'note_input':
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id); // $acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
try { // try {
$ctl="box_input_note".$div; // $ctl="box_input_note".$div;
$html=HtmlInput::title_box(_("Note"), $ctl); // $html=HtmlInput::title_box(_("Note"), $ctl);
$textarea= Acc_Operation_Note::build_textarea($div); // $textarea= Acc_Operation_Note::build_textarea($div);
if ( $http->get('tinymce')=='true') // if ( $http->get('tinymce')=='true')
$textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_html"); // $textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_html");
else { // else {
$textarea->set_enrichText('plain'); // $textarea->set_enrichText('plain');
$textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_text"); // $textarea->value=$acc_operation_note->getJrnNoteSql()->get("n_text");
} // }
//
// start FORM // // start FORM
$html.=sprintf('<form id="form_input_note%s" onsubmit="noalyss.save_note(this);return false;">', // $html.=sprintf('<form id="form_input_note%s" onsubmit="noalyss.save_note(this);return false;">',
$div); // $div);
//
$html.=$textarea->input(); // $html.=$textarea->input();
//
$html.=HtmlInput::hidden('gDossier', $gDossier); // $html.=HtmlInput::hidden('gDossier', $gDossier);
$html.=HtmlInput::hidden('div', $div); // $html.=HtmlInput::hidden('div', $div);
$html.=HtmlInput::hidden('jr_id', $jr_id); // $html.=HtmlInput::hidden('jr_id', $jr_id);
$html.=HtmlInput::hidden('act', 'note_save'); // $html.=HtmlInput::hidden('act', 'note_save');
$html.=HtmlInput::submit("save", _("Sauve")); // $html.=HtmlInput::submit("save", _("Sauve"));
$html.=HtmlInput::hidden("input_html", $textarea->id); // $html.=HtmlInput::hidden("input_html", $textarea->id);
$html.=HtmlInput::button_close($ctl); // $html.=HtmlInput::button_close($ctl);
// end form // // end form
$html.="</form>"; // $html.="</form>";
} catch (Exception $exc) { // } catch (Exception $exc) {
echo $exc->getTraceAsString(); // echo $exc->getTraceAsString();
} //}
//
break; // break;
case 'note_save': // case 'note_save':
//------------------------------------------------ ////------------------------------------------------
// save note //// save note
//------------------------------------------------ ////------------------------------------------------
//
/** // /**
* received parameters // * received parameters
* - gDossier // * - gDossier
* - div // * - div
* - jr_id // * - jr_id
* - note_html // * - note_html
*/ // */
$ctl="box_input_note".$div; // $ctl="box_input_note".$div;
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id); // $acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
$acc_operation_note->setOperation_id($jr_id); // $acc_operation_note->setOperation_id($jr_id);
$acc_operation_note->setNote($http->post("note_html",'raw')); // $acc_operation_note->setNote($http->post("note_html",'raw'));
$acc_operation_note->save(); // $acc_operation_note->save();
$html=$http->post("note_html","raw"); // $html=$http->post("note_html","raw");
break; break;
case 'note_refresh': case 'note_refresh':
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id); $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;"> <table style="width:99%;height:8rem;vertical-align:top;">
<tr style="height: 5%"> <tr style="height: 5%">
<td style="text-align:center;vertical-align: top"> <td style="text-align:center;vertical-align: top">
<button onclick="noalyss.input_note('<?=$dossier_id?>','<?=$jr_id?>','<?=$div?>');return false;" class="smallbutton"> <?php
<?=_("Note")?> $inote = new ITextarea('jrn_note');
</button> $inote->set_enrichText("minimal");
</td></tr> $inote->id="jrn_note{$div}";
<tr> $inote->style=' class="itextarea" style="width:90%;height:100%;"';
<td id="note_html<?=$div?>" style="text-align:center;vertical-align: top"> $inote->value = $obj->det->note_html;
<?=$obj->det->note_html?> $inote->heigh=200;
echo $inote->input();
?>
</td> </td>
</tr> </tr>
<tr> <tr>

View file

@ -82,9 +82,16 @@ echo td(_('Pièce')).td($itext->input());
<table style="width:99%;height:8rem;vertical-align:top;"> <table style="width:99%;height:8rem;vertical-align:top;">
<tr style="height: 5%"> <tr style="height: 5%">
<td style="text-align:center;vertical-align: top"> <td style="text-align:center;vertical-align: top">
<button onclick="noalyss.input_note('<?=$dossier_id?>','<?=$jr_id?>','<?=$div?>');return false;" class="smallbutton"> <?php
<?=_("Note")?> $inote = new ITextarea('jrn_note');
</button> $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> </td>
</tr> </tr>
<tr> <tr>

View file

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

View file

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