From a54af9e09c2f3e9f2e9ed0d33d82c0c2cbd72f0e Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 26 Oct 2025 16:58:10 +0100 Subject: [PATCH] Note on operations are in the detail of the operation --- html/js/acc_ledger.js | 3 +- html/js/noalyss_script.js | 13 ++- include/ajax/ajax_ledger.php | 119 +++++++++++++----------- include/template/ledger_detail_ach.php | 16 ++-- include/template/ledger_detail_fin.php | 13 ++- include/template/ledger_detail_misc.php | 18 ++-- include/template/ledger_detail_ven.php | 23 +++-- 7 files changed, 121 insertions(+), 84 deletions(-) diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 059668cc6..28542f20f 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -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) diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 60ba69941..2aac99b23 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -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; + } } diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php index 5b367c23f..91415fe26 100644 --- a/include/ajax/ajax_ledger.php +++ b/include/ajax/ajax_ledger.php @@ -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('
', - $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.="
"; - } 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('
', +// $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.="
"; +// } 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); diff --git a/include/template/ledger_detail_ach.php b/include/template/ledger_detail_ach.php index e9fc3deaf..bc8678108 100644 --- a/include/template/ledger_detail_ach.php +++ b/include/template/ledger_detail_ach.php @@ -109,14 +109,16 @@ $dossier_id=Dossier::id(); - - diff --git a/include/template/ledger_detail_fin.php b/include/template/ledger_detail_fin.php index 326da5ced..8ded6cc84 100644 --- a/include/template/ledger_detail_fin.php +++ b/include/template/ledger_detail_fin.php @@ -82,9 +82,16 @@ echo td(_('Pièce')).td($itext->input());
- -
- det->note_html?> + 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(); + ?>
diff --git a/include/template/ledger_detail_misc.php b/include/template/ledger_detail_misc.php index f72da784f..c360ea337 100644 --- a/include/template/ledger_detail_misc.php +++ b/include/template/ledger_detail_misc.php @@ -78,14 +78,16 @@ $dossier_id=Dossier::id();
- + 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(); + + ?>
- - + 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(); + + ?> @@ -113,17 +114,21 @@ $str_anc = "";
- -
- det->note_html?> -
diff --git a/include/template/ledger_detail_ven.php b/include/template/ledger_detail_ven.php index 1690c228c..64fcd1f9b 100644 --- a/include/template/ledger_detail_ven.php +++ b/include/template/ledger_detail_ven.php @@ -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); ?>
- + - - - +
- -
- det->note_html?> + 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(); + + ?> +