[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 21/46: Bug #0002011: Encodage opération – Ver
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 21/46: Bug #0002011: Encodage opération – Verrouillage nombre de lignes si non vides |
Date: |
Tue, 13 Jul 2021 05:01:55 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit fcb103068e5a68369506564623348c6088bdb95e
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Mon Jun 14 15:11:59 2021 +0200
Bug #0002011: Encodage opération – Verrouillage nombre de lignes si non
vides
---
html/js/acc_ledger.js | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 42d5f9c..de50775 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -160,9 +160,12 @@ function update_row(ctl)
{
try
{
+ var row_to_keep=3; /* Number of row to keep (head and foot)*/
+ if ( ctl === 'quick_item' ) { row_to_keep=2;} /* for ODS , only 2 rows
to keep */
var jrn = g('p_jrn').value;
var dossier = g('gDossier').value;
var qs = encodeURI('gDossier=' + dossier + '&op=minrow&j=' + jrn +
'&ctl=' + ctl);
+ var current_row = parseFloat($('nb_item').value);
var action = new Ajax.Request(
"ajax_misc.php",
{
@@ -174,7 +177,7 @@ function update_row(ctl)
try {
var answer = request.responseText.evalJSON(true);
var row = parseFloat(answer.row);
- var current_row = parseFloat($('nb_item').value);
+
var table_to_update=$(ctl);
if (current_row > row) {
// Too many row, we always must keep 2 rows
for the sum
@@ -182,10 +185,35 @@ function update_row(ctl)
var idx = $('nb_item').value;
for (var i = 0; i < delta; i++) {
var pos_row=table_to_update.rows.length;
- table_to_update.deleteRow(pos_row-3);
- idx--;
+ var cell0 =
table_to_update.rows[pos_row-row_to_keep].cells[0];
+ var cell0Element=cell0.childNodes;
+ var canDelete=true;
+ /**
+ * prevent truncating
+ */
+ cell0Element.forEach(function (x) {
+ if (canDelete && x.nodeName=='INPUT'
&& x.type==="text" && x.value)
+ {
+ canDelete=false;
+ }}
+ );
+ /*
+ * prevent truncating
+ * For ODS we also need to check the second
column
+ * */
+ if ( canDelete && ctl === 'quick_item') {
+ var cell1 =
table_to_update.rows[pos_row-row_to_keep].cells[1];
+ var cell1Element=cell1.childNodes;
+ cell1Element.forEach(function (x) {
+ if (canDelete && x.nodeName=='INPUT'
&& x.type==="text" && x.value)
+ {
+ canDelete=false;
+ }});
+ }
+ if ( canDelete ) {
table_to_update.deleteRow(pos_row-row_to_keep);idx--;}
+
}
- $('nb_item').value = row;
+ $('nb_item').value =
table_to_update.rows.length-row_to_keep;
}
if (current_row < row) {
// We need to add rows
@@ -203,7 +231,7 @@ function update_row(ctl)
}
}
} catch (e) {
- alert_box(e.message);
+ alert_box("update_row:01"+e.message);
}
}
}
- [Noalyss-commit] [noalyss] 02/46: File cleaning, (continued)
- [Noalyss-commit] [noalyss] 02/46: File cleaning, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 07/46: ocument : add phpunit test, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 11/46: protect SQL, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 16/46: Improve email sent : check if file attached, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 15/46: Task #0001417: Reconnexion souple connect, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 09/46: Add waiting_box, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 17/46: Task #0001595: CA - liste d'opérations - pas de choix de l'execice., Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 19/46: clean code : remove useless comment, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 20/46: New #0001983: CA - permettre désactivation poste, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 18/46: Bug: possible to set an empy name for an Analytic plan, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 21/46: Bug #0002011: Encodage opération – Verrouillage nombre de lignes si non vides,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 23/46: Task #0002014: Comptabilité analytique = export des pièces des opérations rapprochées, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 27/46: Task #0002014: Comptabilité analytique ordre par date Database_Core setter/getter for sql, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 24/46: Task #0001974: Duplication d'opération – Inclure l'intitulé, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 33/46: If database connx failed then reload the form, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 12/46: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 22/46: Cosmetic, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 26/46: Typo menu, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 28/46: Task #0002015: Export CSV depuis ANCGL : ajout de colonnes, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 29/46: Use autoload, Dany De Bontridder, 2021/07/13
- [Noalyss-commit] [noalyss] 31/46: Module decrease font-size, Dany De Bontridder, 2021/07/13