[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 02/27: Bug : fix problem with reformating num
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 02/27: Bug : fix problem with reformating number in Sales and Purchase Ledger |
Date: |
Sat, 2 Nov 2019 18:12:12 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 4deb13bf0067cd4a1102913a27a1f95ae2a4e83e
Author: Dany De Bontridder <address@hidden>
Date: Fri Nov 1 09:49:10 2019 +0100
Bug : fix problem with reformating number in Sales and Purchase Ledger
---
html/fid.php | 9 +++++----
include/ajax/ajax_card.php | 13 +++++++++----
include/class/acc_ledger_purchase.class.php | 8 ++++----
include/class/acc_ledger_sold.class.php | 6 +++---
4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/html/fid.php b/html/fid.php
index 005b11d..814a283 100644
--- a/html/fid.php
+++ b/html/fid.php
@@ -125,14 +125,15 @@ if ( isset($_SESSION['isValid']) && $_SESSION['isValid']
== 1)
$name=$array[0]['vw_name'];
- $sell=$array[0]['vw_sell'] ;
- $buy=$array[0]['vw_buy'];
+ $sell=(isNumber($array[0]['vw_sell']) == 1) ? $array[0]['vw_sell'] : 0 ;
+ $buy=(isNumber($array[0]['vw_buy']) == 1) ?$array[0]['vw_buy']:0;
+
$tva_id=$array[0]['tva_id'];
// Check null
$name=($name==null)?" ":str_replace('"','',$name);
- $sell=($sell==null)?" ":str_replace('"','',$sell);
- $buy=($buy==null)?" ":str_replace('"','',$buy);
+ $sell=($sell==null)?"0":str_replace('"','',$sell);
+ $buy=($buy==null)?"0":str_replace('"','',$buy);
$tva_id=($tva_id==null)?" ":str_replace('"','',$tva_id);
/* store the answer in an array and transform it later into a JSON object
*/
$tmp=array();
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index cfc4716..5c291bc 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -433,12 +433,17 @@ case 'fs':
/* if it is a ledger of sales we use vw_buy
if it is a ledger of purchase we use vw_sell*/
- if ( $type=="ACH" )
+
+ if ( $type=="ACH" ){
+ $amount=(isNumber($a[$i]['vw_buy']) == 1 )?$a[$i]['vw_buy']:0;
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
- $price,$a[$i]['vw_buy']);
- if ( $type=="VEN" )
+ $price,$amount);
+ }
+ if ( $type=="VEN" ){
+ $amount=(isNumber($a[$i]['vw_buy']) == 1 )?$a[$i]['vw_sell']:0;
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
- $price,$a[$i]['vw_sell']);
+ $price,$amount);
+ }
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
$tvaid,$a[$i]['tva_id']);
$array[$i]['javascript'].="removeDiv('search_card');";
diff --git a/include/class/acc_ledger_purchase.class.php
b/include/class/acc_ledger_purchase.class.php
index 1aada13..c469499 100644
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@ -1265,7 +1265,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$Price=new INum();
$Price->setReadOnly(false);
$Price->size=9;
-
$Price->javascript="onBlur='format_number(this,4);clean_tva($i);compute_ledger($i)'";
+
$Price->javascript="onblur=\"format_number(this,4);clean_tva($i);compute_ledger($i)\"";
$array[$i]['pu']=$Price->input("e_march".$i."_price",$march_price);
if ( $g_parameter->MY_TVA_USE=='Y')
{
@@ -1273,7 +1273,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
// vat label
//--
$Tva=new ITva_Popup($this->db);
-
$Tva->js="onblur=\"format_number(this);onChange=clean_tva($i);compute_ledger($i)\"";
+
$Tva->js="onblur=\"format_number(this);clean_tva($i);compute_ledger($i)\"";
$Tva->in_table=true;
$Tva->set_attribute('compute',$i);
$Tva->set_filter("purchase");
@@ -1286,7 +1286,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$Tva_amount=new INum();
$Tva_amount->setReadOnly(false);
$Tva_amount->size=9;
-
$Tva_amount->javascript="onBlur='format_number(this);compute_ledger($i)'";
+
$Tva_amount->javascript="onblur=\"format_number(this);compute_ledger($i)\"";
$array[$i]['amount_tva']=$Tva_amount->input("e_march".$i."_tva_amount",$march_tva_amount);
}
// quantity
@@ -1296,7 +1296,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$Quantity=new INum();
$Quantity->setReadOnly(false);
$Quantity->size=9;
-
$Quantity->javascript="onChange=format_number(this);clean_tva($i);compute_ledger($i)";
+
$Quantity->javascript="onchange=\"format_number(this);clean_tva($i);compute_ledger($i)\"";
$array[$i]['quantity']=$Quantity->input("e_quant".$i,$quant);
}
diff --git a/include/class/acc_ledger_sold.class.php
b/include/class/acc_ledger_sold.class.php
index 8a6ff3e..ef09d1f 100644
--- a/include/class/acc_ledger_sold.class.php
+++ b/include/class/acc_ledger_sold.class.php
@@ -1303,7 +1303,7 @@ EOF;
$Price = new INum();
$Price->setReadOnly(false);
$Price->size = 9;
- $Price->javascript =
"onBlur='format_number(this,4);clean_tva($i);compute_ledger($i)'";
+ $Price->javascript =
"onblur=\"format_number(this,4);clean_tva($i);compute_ledger($i)\"";
$array[$i]['pu'] = $Price->input("e_march" . $i . "_price",
$march_price);
$array[$i]['tva'] = '';
$array[$i]['amount_tva'] = '';
@@ -1324,7 +1324,7 @@ EOF;
$wTva_amount = new INum();
$wTva_amount->readOnly = false;
$wTva_amount->size = 6;
- $wTva_amount->javascript =
"onBlur='format_number(this);compute_ledger($i)'";
+ $wTva_amount->javascript =
"onblur='format_number(this);compute_ledger($i)'";
$array[$i]['amount_tva'] = $wTva_amount->input("e_march" . $i
. "_tva_amount", $march_tva_amount);
}
// quantity
@@ -1334,7 +1334,7 @@ EOF;
$Quantity = new INum();
$Quantity->setReadOnly(false);
$Quantity->size = 8;
- $Quantity->javascript =
"onChange='format_number(this);clean_tva($i);compute_ledger($i)'";
+ $Quantity->javascript =
"onchange='format_number(this);clean_tva($i);compute_ledger($i)'";
$array[$i]['quantity'] = $Quantity->input("e_quant" . $i, $quant);
}// foreach article
$f_type = _('Client');
- [Noalyss-commit] [noalyss] branch master updated (9e55774 -> a56f8cc), Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 02/27: Bug : fix problem with reformating number in Sales and Purchase Ledger,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 04/27: Merge branch 'dev7103', Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 05/27: Code Cleaning : remove funciton getDefLine, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 10/27: Acc_Ledger_History add documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 08/27: Acc_Ledger_FIN Remove DeadCode : show_ledger, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 09/27: Test : Acc_Ledger_FIN, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 12/27: Test : Acc_Ledger_History_Financial Test : Acc_Ledger_History_Purchase Add function phpunit_page_start, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 03/27: Merge branch 'v7110-stable', Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 01/27: documentation, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 06/27: Code Cleaning : remove direct access to global , add Exception, Dany De Bontridder, 2019/11/02
- [Noalyss-commit] [noalyss] 25/27: TEST fix bug in acc_balanceTest, Dany De Bontridder, 2019/11/02