Skip to content

Commit

Permalink
NEW: Automatically fill matching extra fields of object on line creat…
Browse files Browse the repository at this point in the history
…ion. (#27240)

* Update objectline_create.tpl.php - Auto-fill matching extra fields

This change allows to automatically fill the matching extra fields in a form when adding an object (product/service).

* Change spaces to tabs.
  • Loading branch information
ionutfinta authored Feb 12, 2024
1 parent e89f930 commit e89dd3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions htdocs/core/tpl/objectline_create.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,17 @@ function(data) {
jQuery("#price_ht").val(data.price_ht);
}

// Set values for any fields in the form options_SOMETHING
for (var key in data.array_options) {
if (data.array_options.hasOwnProperty(key)) {
var field = jQuery("#" + key);
if(field.length > 0){
console.log("objectline_create.tpl set content of options_" + key);
field.val(data.array_options[key]);
}
}
}

var tva_tx = data.tva_tx;
var default_vat_code = data.default_vat_code;

Expand Down

0 comments on commit e89dd3b

Please sign in to comment.