diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 497f676ae8c..3f16a20d98b 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -179,12 +179,6 @@ if (empty($reshook)) ); } - if (!$error && $object->update($object->id, $user) < 1) { - $error++; - setEventMessage($object->error, 'errors'); - $action = 'edit_price'; - } - if (!$error) { $db->begin(); @@ -215,6 +209,11 @@ if (empty($reshook)) } } + if (!$error && $object->update($object->id, $user) < 0) { + $error++; + setEventMessage($object->error, 'errors'); + } + if (empty($error)) { $action = ''; setEventMessage($langs->trans("RecordSaved")); @@ -713,7 +712,7 @@ print "\n"; print ''; print '
'; - + dol_fiche_end(); @@ -793,7 +792,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se print '

'; } -if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer)) +if ($action == 'edit_price' && $object->getRights()->creer) { print load_fiche_titre($langs->trans("NewPrice"), ''); @@ -809,7 +808,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; // VAT - print ''; @@ -817,7 +816,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; - print ''; print ''; @@ -825,7 +824,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> // Only show price mode and expression selector if module is enabled if (! empty($conf->dynamicprices->enabled)) { // Price mode selector - print ''; + // This code hides the numeric price input if is not selected, loads the editor page if editor button is pressed - print ''; + + rights->produit->creer || $user->rights-> print 'global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { + print ' colspan="2"'; } + print '>'; + if ($object->price_base_type == 'TTC') { + print ''; + } else { + print ''; + } + print ''; if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { print ''; } - print ''; + print ''; print '
' . $langs->trans("VATRate") . ''; + print '
' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); print '
'; print $langs->trans('PriceBase'); print ''; + print ''; print $form->selectPriceBaseType($object->price_base_type, "price_base_type"); print '
'.$langs->trans("PriceMode").''; + print '
'.$langs->trans("PriceMode").''; $price_expression = new PriceExpression($db); $price_expression_list = array(0 => $langs->trans("PriceNumeric")); //Put the numeric mode as first option foreach ($price_expression->list_price_expression() as $entry) { @@ -835,17 +834,18 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print $form->selectarray('eid', $price_expression_list, $price_expression_preselection); print ' 
'.$langs->trans("PriceExpressionEditor").'
'; print '
'; $text = $langs->trans('SellingPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); - print ''; + print ''; if ($object->price_base_type == 'TTC') { print ''; } else { @@ -874,16 +875,22 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print '
'; $text = $langs->trans('MinPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); - if ($object->price_base_type == 'TTC') { - print ''; - } else { - print ''; + print ''.$langs->trans("MinimumRecommendedPrice", price($maxpricesupplier,0,'',1,-1,-1,'auto')).' '.img_warning().'
'; @@ -906,8 +913,8 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->