diff --git a/html/js/noalyss_checkbox.js b/html/js/noalyss_checkbox.js
index 61272c176..a04fa1469 100644
--- a/html/js/noalyss_checkbox.js
+++ b/html/js/noalyss_checkbox.js
@@ -87,6 +87,26 @@ function activate_checkbox_range(p_range_name) {
checkbox_set_range(event, elt, p_range_name);
},false));
}
-;
+/**
+ * Checkbox for Debit - Credit , from Misc Operation
+ */
+function activate_checkbox_side()
+{
+ var aCheckBox=$$('.debit-credit')
+ aCheckBox.forEach((item)=>item.addEventListener('click',function (event) {display_dcside(item)}))
+ aCheckBox.forEach((item)=>display_dcside(item))
+}
+/**
+ * Update the SPAN , id based on checkbox id (txtck0), if checked , display Debit otherwise Credit
+ * @param item
+ */
+function display_dcside(item)
+{
+ if (item.checked == true) {
+ $('txt'+item.id).update("Débit")
+ } else {
+ $('txt'+item.id).update("Crédit")
+ }
+}
diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php
index 01f1b7c3c..41650f0b3 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -995,7 +995,7 @@ class Acc_Ledger extends jrn_def_sql
'
'._('Poste').$info_poste.' | '.
''._('Libellé').' | '.
''._('Montant').' | '.
- ''._('Débit').' | '.
+ ''._('Côté').' | '.
'';
@@ -1065,13 +1065,13 @@ class Acc_Ledger extends jrn_def_sql
$amount->value=(isset(${'amount'.$i}))?${"amount".$i}:''
;
$amount->readonly=$p_readonly;
- $amount->javascript=' onChange="format_number(this);checkTotalDirect()"';
+ $amount->javascript='onChange="format_number(this);checkTotalDirect()"';
// D/C
$deb=new ICheckBox();
$deb->name='ck'.$i;
$deb->selected=(isset(${'ck'.$i}))?true:false;
$deb->readonly=$p_readonly;
- $deb->javascript=' onChange="checkTotalDirect()"';
+ $deb->javascript='class="debit-credit" onChange="checkTotalDirect()"';
$str_add_button=($add_card==true)?$this->add_card("-1",
$quick_code->id):"";
$ret.='';
@@ -1085,7 +1085,9 @@ class Acc_Ledger extends jrn_def_sql
'';
$ret.='| '.$line_desc->input().' | ';
$ret.=''.$amount->input().' | ';
- $ret.=''.$deb->input().' | ';
+ $ret.=''.$deb->input()
+ .''
+ .' | ';
$ret.='
';
// If readonly == 1 then show CA
}
@@ -1099,6 +1101,9 @@ class Acc_Ledger extends jrn_def_sql
$ret.=sprintf(_("Réconciliation/rapprochements : %s"), $w->input());
}
$ret.=create_script("$('".$wDate->id."').focus()");
+ // for displaying Credit or Debit
+ $ret.=create_script("activate_checkbox_side()");
+
return $ret;
}
diff --git a/include/operation_ods_new.inc.php b/include/operation_ods_new.inc.php
index 5b5197a0b..811434099 100644
--- a/include/operation_ods_new.inc.php
+++ b/include/operation_ods_new.inc.php
@@ -25,6 +25,7 @@
* \brief to write into the ledgers ODS a new operation
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+\Noalyss\Dbg::echo_file(__FILE__);
global $g_user,$g_parameter,$http;