FIX : problem with VAT SELECT: cannot update the right DOMID

This commit is contained in:
sparkyx 2025-11-22 08:40:33 +01:00
parent 71f8a7fc82
commit 3716395a8e
5 changed files with 29 additions and 11 deletions

View file

@ -609,8 +609,8 @@ function popup_select_tva(obj, p_function_callback) {
if (document.getElementById('tva_select')) {
removeDiv('tva_select');
}
var queryString = "gDossier=" + obj.gDossier + "&op=dsp_tva" + "&ctl=" + obj.ctl + '&popup=' + 'tva_select';
var queryString = "gDossier=" + obj.getAttribute("gdossier") + "&op=dsp_tva" + "&ctl=" + obj.getAttribute("ctl") + '&popup=' + 'tva_select';
if (obj.jcode)
queryString += '&code=' + obj.jcode;
if (obj.compute)
@ -641,7 +641,7 @@ function popup_select_tva(obj, p_function_callback) {
var nTop = posY - 200;
var nLeft = "15%";
var str_style = "top:" + nTop + "px;left:" + nLeft + ";right:" + nLeft + ";width:55em;height:auto";
var str_style = "top:" + nTop + "px;left:" + nLeft + ";right:" + nLeft + ";width:55em;height:auto;z-index:"+get_next_layer()+';';
var popup = {
'id': 'tva_select',
@ -2202,10 +2202,11 @@ function view_action(ag_id, dossier, modify) {
* @param _id : id of the table
* @param colnr : string containing the column number where you're searching separated by a comma
* @param start_row : first row (1 if you have table header)
* @param class 2nd filter on the CSS CLASS of the row (TR), domid of the TAG containing the classname (TagName: SELECT, HIDDEN, TEXT )
* @returns nothing
* @see HtmlInput::filter_table
*/
function filter_table(phrase, _id, colnr, start_row) {
function filter_table(phrase, _id, colnr, start_row,classname) {
id$('info_div').innerHTML = content[65];
id$('info_div').style.display = "block";
var words = id$(phrase).value.toLowerCase();
@ -2220,8 +2221,17 @@ function filter_table(phrase, _id, colnr, start_row) {
}
var ele;
var tot_found = 0;
for (var r = start_row; r < table.rows.length; r++) {
console.debug(`filter is ${classname}`)
var row_class="";
if ( classname ) row_class=id$(classname).value;
for (var r = start_row; r < table.rows.length; r++)
{
if ( row_class != "" && ! table.rows[r].hasClassName(row_class)) {
console.debug(`no check ${r} ${classname}`)
continue;
}
console.debug(`checked ${r} ${classname}`)
var found = 0;
for (var col = 0; col < aCol.length; col++) {
var idx = aCol[col];
@ -5000,6 +5010,7 @@ VAT_Code.prototype.list_vatex=function ()
{
try
{
var here=this;
var dgbox = "search_vatex_div";
waiting_box();
removeDiv(dgbox);
@ -5023,7 +5034,7 @@ VAT_Code.prototype.list_vatex=function ()
var div_style = "position:absolute;" + ";top:" + y + "px"+";z-index:"+get_next_layer();
add_div({id: dgbox, cssclass: 'inner_box', html: loading(), style: div_style, drag: false});
$(dgbox).update(req.responseText);
here.filter_country();
}
}
@ -5078,7 +5089,7 @@ VAT_Code.prototype.select_value=function(vx_code)
VAT_Code.prototype.filter_country=function()
{
try {
var to_show="country"+id$("filter_country").value;
var to_show=id$("filter_country").value;
console.debug(`show ${to_show}`)
let a_row=id$("code_vatex_tb").rows;
// show all rows, then hide
@ -5093,7 +5104,7 @@ VAT_Code.prototype.filter_country=function()
console.debug(`hide row ${i}`)
}
}
$('lk_code_vatex_tb').value="";
}catch (e)
{
console.error(e.message);

View file

@ -50,7 +50,10 @@ switch ($op2)
*
----------------------------------------------------------------------*/
case "sf":
$ipopup=$ctl;
if ( ! isset($ctl)) {
$ctl= uniqid();
}
$ipopup=$ctl;
$attr=sprintf('this.ctl=\'%s\';',$ipopup);
$ctl.='_content';
$it=new IText('acc_query');

View file

@ -224,7 +224,7 @@ class Card_Property
}
if ($this->ad_id == ATTR_DEF_TVA) {
$result['input'] = new ITva_Popup('popup_tva');
$result['input'] = new ITva_Popup( "av_text" . $this->ad_id);
$result['input']->table = 0;
$result['input']->value = $this->av_text;
$result['label']=$this->ad_text;

View file

@ -206,6 +206,9 @@ class Tva_Rate_MTable extends Manage_Table_SQL
{
$text=\HtmlInput::hidden("vx_code",$value);
echo $text;
if ( $value !="") {
$value= \Icon_Action::trash(uniqid(),"vat_code.select_value('xx')").$value;
}
echo span($value,'id="vx_value"');
$js=sprintf("vat_code.list_vatex()");
echo \Icon_Action::icon_magnifier(uniqid(),$js );

View file

@ -61,6 +61,7 @@ class ITva_Popup extends HtmlInput
$this->button = true;
$this->in_table = false;
$this->value = $p_value;
if ($p_id =="") $p_id= uniqid ("vat");
$this->id = $p_id;
$this->filter = 'none';
}