diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 90322f2ef49..3b030c6fdfb 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2217,6 +2217,10 @@ if (empty($reshook)) { if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } elseif (!empty($price_ht_devise) || $price_ht_devise === '0') { + $pu_ht_devise = price2num($price_ht_devise, 'MU'); + $pu_ht = ''; + $pu_ttc = ''; } elseif (!empty($price_ttc) || $price_ttc === '0') { $pu_ttc = price2num($price_ttc, 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); @@ -2308,8 +2312,10 @@ if (empty($reshook)) { $type = $prod->type; $fk_unit = $prod->fk_unit; } else { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($price_ttc, 'MU'); + if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU'); + else $pu_ht = ''; + if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU'); + else $pu_ttc = ''; $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); $tva_tx = str_replace('*', '', $tva_tx); if (empty($tva_tx)) { @@ -2335,8 +2341,8 @@ if (empty($reshook)) { $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2); - $pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2); + $pu_ht_devise = price2num($price_ht_devise, '', 2); + $pu_ttc_devise = price2num($price_ttc_devise, '', 2); // Prepare a price equivalent for minimum price check $pu_equivalent = $pu_ht; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 7411a7e9166..0d7bdce4acc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1791,7 +1791,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } $price_base_type = 'HT'; - $pu_devise = price2num($price_devise, 'CU'); + $pu_devise = price2num($price_ht_devise, 'CU'); $result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier); } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 76484c12e18..1322c29672f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2207,17 +2207,18 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (isset($_POST) && is_array($_POST)) { foreach ($_POST as $key => $value) { + $key = preg_replace('/[^a-z0-9_\.\-\[\]]/i', '', $key); if (in_array($key, array('action', 'massaction', 'password'))) { continue; } if (!is_array($value)) { if ($value !== '') { - $qs .= '&'.$key.'='.urlencode($value); + $qs .= '&'.urlencode($key).'='.urlencode($value); } } else { foreach ($value as $value2) { if (($value2 !== '') && (!is_array($value2))) { - $qs .= '&'.$key.'[]='.urlencode($value2); + $qs .= '&'.urlencode($key).'[]='.urlencode($value2); } } } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1d2b8416878..13c57199462 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -504,8 +504,11 @@ if (empty($reshook)) { $newobject->fetch_optionals(); $newobject->fetch_thirdparty(); // Load new object $object = $newobject; - $action = 'edit'; + $action = 'view'; $comefromclone = true; + + setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), "", 'mesgs'); + //var_dump($newobject); exit; } }