diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 68cff3dc49c..e5adb3a9105 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -966,24 +966,24 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST // Define info_bits $info_bits=0; - if (preg_match('/\*/',$_POST['np_tva_tx'])) $info_bits |= 0x01; + if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01; // Define vat_rate - $vat_rate=$_POST['np_tva_tx']; + $vat_rate=$_POST['tva_tx']; $vat_rate=str_replace('*','',$vat_rate); $localtax1_rate=get_localtax($vat_rate,1,$object->client); $localtax2_rate=get_localtax($vat_rate,2,$object->client); // Check parameters - if (empty($_POST['productid']) && $_POST["type"] < 0) + if (! GETPOST('productid') && GETPOST("type") < 0) { $mesg = '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'
'; $result = -1 ; } // Check minimum price - if(! empty($_POST['productid'])) + if (GETPOST('productid')) { - $productid = $_POST['productid']; + $productid = GETPOST('productid'); $product = new Product($db); $product->fetch($productid); $type=$product->type; @@ -995,23 +995,17 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST } // Define params - if (! empty($_POST['productid'])) - { - $type=$product->type; - } - else - { - $type=$_POST["type"]; - } + if (GETPOST('productid')) $type=$product->type; + else $type=GETPOST("type"); // Update line if ($result >= 0) { - $result = $object->updateline($_POST['rowid'], + $result = $object->updateline(GETPOST('lineid'), $description, - $_POST['price'], - $_POST['qty'], - $_POST['remise_percent'], + GETPOST('subprice'), + GETPOST('qty'), + GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, @@ -1025,7 +1019,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST // Define output language $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3e62344833a..9d30de012d2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1794,21 +1794,21 @@ class Facture extends CommonObject } /** - * \brief Update line - * \param rowid Id of line to update - * \param desc Description of line - * \param pu Prix unitaire (HT ou TTC selon price_base_type) - * \param qty Quantity - * \param remise_percent Pourcentage de remise de la ligne - * \param date_start Date de debut de validite du service - * \param date_end Date de fin de validite du service - * \param tva_tx VAT Rate - * \param txlocaltax1 Local tax 1 rate - * \param txlocaltax2 Local tax 2 rate - * \param price_base_type HT or TTC - * \param info_bits Miscellanous informations - * \param type Type of line (0=product, 1=service) - * \return int < 0 si erreur, > 0 si ok + * Update a detail line + * @param rowid Id of line to update + * @param desc Description of line + * @param pu Prix unitaire (HT ou TTC selon price_base_type) + * @param qty Quantity + * @param remise_percent Pourcentage de remise de la ligne + * @param date_start Date de debut de validite du service + * @param date_end Date de fin de validite du service + * @param tva_tx VAT Rate + * @param txlocaltax1 Local tax 1 rate + * @param txlocaltax2 Local tax 2 rate + * @param price_base_type HT or TTC + * @param info_bits Miscellanous informations + * @param type Type of line (0=product, 1=service) + * @return int < 0 si erreur, > 0 si ok */ function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0,$price_base_type='HT', $info_bits=0, $type=0) { diff --git a/htdocs/core/tpl/freeproductline_edit.tpl.php b/htdocs/core/tpl/freeproductline_edit.tpl.php index 94301e53f57..c5f2af84aaa 100644 --- a/htdocs/core/tpl/freeproductline_edit.tpl.php +++ b/htdocs/core/tpl/freeproductline_edit.tpl.php @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ + * + * Need to have object $this (invoice, order, ...) and $line defined */ ?> @@ -25,7 +27,8 @@ -"> + + >