diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 1f891235d..e54dfef3c 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -313,7 +313,9 @@ $path = array(
// Mobile device menu from mobile_device_mtable
"mobile_device_menu"=>"ajax_mobile_device_menu",
// other_tax
- "other_tax"=>"ajax_other_tax"
+ "other_tax"=>"ajax_other_tax",
+ //visibility quantity
+ "update_visibility_quantity"=>"ajax_update_visibility_quantity"
) ;
if (array_key_exists($op, $path)) {
@@ -639,7 +641,7 @@ EOF;
{
echo '
';
echo '
'.$ajrn[0]['jrn_def_name'].'
';
- if ( trim($ajrn[0]['jrn_def_description']) != "") {
+ if ( noalyss_trim($ajrn[0]['jrn_def_description']) != "") {
echo '
'.$ajrn[0]['jrn_def_description'].'
';
}
echo '
';
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index 0ebebe666..2e70ac942 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -141,6 +141,7 @@ function error_get_predef(request, json)
alert_box(content[49]);
}
+
/**
* update the list of available predefined operation when we change the ledger.
*/
@@ -265,6 +266,45 @@ function update_row(ctl)
alert_box(e.message);
}
}
+
+/**
+ * @brief hide or show the column quantity
+ */
+function update_visibility_quantity()
+{
+ var jrn = g("p_jrn").value;
+ var dossier = g("gDossier").value;
+ var querystring = 'gDossier=' + dossier + '&l=' + jrn + "&op=update_visibility_quantity";
+ var action = new Ajax.Request(
+ "ajax_misc.php",
+ {
+ method: 'get',
+ parameters: querystring,
+ onSuccess: function (req) {
+ try {
+ // retrieve quantity
+ var quantity_col=document.getElementsByClassName("col_quant");
+ for (var i=0;i < quantity_col.length;i++){
+ if (req.responseText=="0") {
+ // hide the columns quantity and return
+ quantity_col[i].hide();
+ quantity_col[i].addClassName('d-none');
+ }
+ if (req.responseText=="1") {
+ // show the columns quantity and return
+ quantity_col[i].show();
+ quantity_col[i].removeClassName('d-none');
+ }
+ }
+ } catch (e) {
+ console.error("update_visibility_quantity"+e.message);
+ }
+
+
+ }
+ }
+ );
+}
/**
* Put into the span, the name of the bank, the bank account
* and the quick_code
diff --git a/include/ajax/ajax_update_visibility_quantity.php b/include/ajax/ajax_update_visibility_quantity.php
new file mode 100644
index 000000000..6bbffdca9
--- /dev/null
+++ b/include/ajax/ajax_update_visibility_quantity.php
@@ -0,0 +1,35 @@
+get("l","number",0));
+$ledger->load();
+if ($ledger->id==0) throw new Exception("UPDVIS34.Invalide ledger");
+echo $ledger->has_quantity();
\ No newline at end of file
diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php
index 20ff4c7fd..926b3930b 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -1131,6 +1131,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
public function input($p_array=null,$p_readonly=0)
{
global $g_parameter,$g_user;
+ // load ledger definition
+ $this->load();
$http=new HttpInput();
if ( $p_array != null ) extract($p_array, EXTR_SKIP);
@@ -1217,7 +1219,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$add_js.='update_name();';
$add_js.='update_pay_method();';
$add_js.='update_row("sold_item");';
- $add_js.='update_other_tax()';
+ $add_js.='update_other_tax();';
+ $add_js.='update_visibility_quantity();';
$wLedger=$this->select_ledger('ACH',2,FALSE);
diff --git a/include/class/acc_ledger_sale.class.php b/include/class/acc_ledger_sale.class.php
index 608be7a10..9213986f8 100644
--- a/include/class/acc_ledger_sale.class.php
+++ b/include/class/acc_ledger_sale.class.php
@@ -253,6 +253,8 @@ class Acc_Ledger_Sale extends Acc_Ledger {
public function insert($p_array = null) {
global $g_parameter;
+ // load ledger definition
+ $this->load();
extract($p_array, EXTR_SKIP);
$this->verify($p_array);
@@ -873,7 +875,7 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$r.='';
$r.='';
$r.='';
- $r.='';
+ $r.='
';
$r.='
';
$r.='
' . _('Détail articles vendus') . '
';
@@ -1254,6 +1256,8 @@ EOF;
function input($p_array = null, $p_readonly = 0) {
global $g_parameter, $g_user;
+ // load ledger definition
+ $this->load();
$http=new HttpInput();
if ($p_array != null) {
extract($p_array, EXTR_SKIP);
@@ -1329,7 +1333,8 @@ EOF;
$add_js.='update_name();';
$add_js.='update_pay_method();';
$add_js.='update_row("sold_item");';
- $add_js.='update_other_tax()';
+ $add_js.='update_other_tax();';
+ $add_js.='update_visibility_quantity();';
$wLedger = $this->select_ledger('VEN', 2,FALSE);
if ($wLedger == null)
diff --git a/include/template/form_ledger_detail.php b/include/template/form_ledger_detail.php
index d3b536b56..493a8e320 100644
--- a/include/template/form_ledger_detail.php
+++ b/include/template/form_ledger_detail.php
@@ -81,6 +81,9 @@
+has_quantity()==0)?'d-none':'';
+?>
@@ -88,7 +91,7 @@
|
|
- |
+ |
|
|
|
@@ -112,7 +115,7 @@ echo ''.$item['bt'].$item['card_add'].' | ';
|