diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 6ad0b11fb3c..97886d66fd3 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -673,10 +673,12 @@ else if ($action == "addline" && $user->rights->propal->creer) $prod = new Product($db); $prod->fetch($idprod); + $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); + // If prices fields are update - if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc'))) + if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($price_ht)) { - $pu_ht=price2num(GETPOST('price_ht'), 'MU'); + $pu_ht=price2num($price_ht, 'MU'); $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); $tva_tx=str_replace('*','', GETPOST('tva_tx')); $tva_npr=preg_match('/\*/', GETPOST('tva_tx'))?1:0; @@ -717,7 +719,7 @@ else if ($action == "addline" && $user->rights->propal->creer) } } - if (GETPOST('update_desc')) { + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { $desc = $product_desc; @@ -747,8 +749,6 @@ else if ($action == "addline" && $user->rights->propal->creer) $desc.= $product_desc; } - $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); - $type = $prod->type; } else diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 671ccd3c4bd..da69da4169b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -582,10 +582,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) $prod = new Product($db); $prod->fetch($idprod); + $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); + // Update if prices fields are defined - if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc'))) + if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($price_ht)) { - $pu_ht=price2num(GETPOST('price_ht'), 'MU'); + $pu_ht=price2num($price_ht, 'MU'); $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); $tva_tx=str_replace('*','', GETPOST('tva_tx')); $tva_npr=preg_match('/\*/', GETPOST('tva_tx'))?1:0; @@ -626,7 +628,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) } } - if (GETPOST('update_desc')) { + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { $desc = $product_desc; @@ -656,8 +658,6 @@ else if ($action == 'addline' && $user->rights->commande->creer) $desc.= $product_desc; } - $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); - $type = $prod->type; } else diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b5b8562fa77..88fc72f3ebf 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1013,10 +1013,12 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $prod = new Product($db); $prod->fetch($idprod); + $label = ((GETPOST('product_label') && GETPOST('product_label')!=$prod->label)?GETPOST('product_label'):''); + // Update if prices fields are defined - if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc'))) + if ($conf->global->MAIN_FEATURES_LEVEL > 1 && isset($price_ht)) { - $pu_ht=price2num(GETPOST('price_ht'), 'MU'); + $pu_ht=price2num($price_ht, 'MU'); $pu_ttc=price2num(GETPOST('price_ttc'), 'MU'); $tva_tx=str_replace('*','', GETPOST('tva_tx')); $tva_npr=preg_match('/\*/', GETPOST('tva_tx'))?1:0; @@ -1057,7 +1059,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } } - if (GETPOST('update_desc')) { + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { $desc = $product_desc; @@ -1097,8 +1099,6 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $desc.= (dol_textishtml($desc)?"
\n":"\n").$tmptxt; } - $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); - $type = $prod->type; } else diff --git a/htdocs/core/ajax/vatrates.php b/htdocs/core/ajax/vatrates.php index 42ae0d3e670..0abe98d3251 100644 --- a/htdocs/core/ajax/vatrates.php +++ b/htdocs/core/ajax/vatrates.php @@ -58,7 +58,7 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) } else { - $buyer = $mysoc; + $buyer = $mysoc; $seller = $soc; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8b9ecbeaa01..95af5d1ff25 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1145,7 +1145,7 @@ class Form global $langs,$conf,$user,$db; $sql = "SELECT "; - $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.duration, p.stock"; + $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock"; // Multilang : we add translation if (! empty($conf->global->MAIN_MULTILANGS)) { @@ -1216,6 +1216,7 @@ class Form $outprice_ht=''; $outprice_ttc=''; $outpricebasetype=''; + $outtva_tx=''; $objp = $this->db->fetch_object($result); @@ -1258,9 +1259,9 @@ class Form // Multiprice if ($price_level >= 1) // If we need a particular price level (from 1 to 6) { - $sql= "SELECT price, price_ttc, price_base_type "; - $sql.= "FROM ".MAIN_DB_PREFIX."product_price "; - $sql.= "WHERE fk_product='".$objp->rowid."'"; + $sql = "SELECT price, price_ttc, price_base_type, tva_tx"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_price"; + $sql.= " WHERE fk_product='".$objp->rowid."'"; $sql.= " AND price_level=".$price_level; $sql.= " ORDER BY date_price"; $sql.= " DESC LIMIT 1"; @@ -1286,6 +1287,7 @@ class Form $outprice_ht=price($objp2->price); $outprice_ttc=price($objp2->price_ttc); $outpricebasetype=$objp2->price_base_type; + $outtva_tx=$objp2->tva_tx; } } else @@ -1310,6 +1312,7 @@ class Form $outprice_ht=price($objp->price); $outprice_ttc=price($objp->price_ttc); $outpricebasetype=$objp->price_base_type; + $outtva_tx=$objp->tva_tx; } if (! empty($conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) @@ -1340,7 +1343,7 @@ class Form // "key" value of json key array is used by jQuery automatically as selected value // "label" value of json key array is used by jQuery automatically as text for combo box $outselect.=$opt; - array_push($outjson, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype)); + array_push($outjson, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx)); $i++; } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index b47db30d670..a1a211fac91 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -75,6 +75,15 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt $("#" + value).hide().trigger("hide"); }); } + if (options.update_textarea) { + $.each(options.update_textarea, function(key, value) { + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances[key] != "undefined") { + CKEDITOR.instances[key].setData(""); + } else { + $("#" + key).html(""); + } + }); + } } } }); diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 9b6b9e64b0f..d86400b8fbc 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -74,18 +74,17 @@ if (! empty($conf->margin->enabled)) { 'select_type' => 'type', 'product_ref' => 'value', 'product_label' => 'label2', - 'origin_label_cache' => 'label2', - 'origin_desc_cache' => 'desc', 'price_base_type' => 'pricebasetype', 'price_ht' => 'price_ht', - 'origin_price_ht_cache' => 'price_ht' - //'price_ttc' => 'price_ttc', - //'origin_price_ttc_cache' => 'price_ttc' + 'origin_price_ht_cache' => 'price_ht', + 'origin_tva_tx_cache' => 'tva_tx', + 'origin_price_ttc_cache' => 'price_ttc' + ), + 'update_textarea' => array( + 'product_desc' => 'desc' ), 'show' => array( - 'update_label_area', - 'update_desc_area', - 'update_price_area' + 'price_base_type_area' ), 'disabled' => array( 'select_type' @@ -102,6 +101,7 @@ if (! empty($conf->margin->enabled)) { textwithtooltip($langs->trans('AddThisServiceCard'), $langs->trans('HelpAddThisServiceCard'),1,0,'','',3); ?> + > - select_type_of_lines((GETPOST('type')?GETPOST('type'):-1), 'type', 1); - - echo ' '; - echo ''; - - echo ' '; - echo ''; - echo ''; + select_type_of_lines((GETPOST('type')?GETPOST('type'):-1), 'type', 1); ?> + +   + + + +   + + + + | trans('PriceBase'); ?>: + + +GETPOST('fk_parent_line')); @@ -156,7 +161,7 @@ if (! empty($conf->margin->enabled)) { if ($buyer->tva_assuj == "0") echo '0'; else echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer); ?> - + @@ -215,20 +220,16 @@ if (! empty($conf->margin->enabled)) {