diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 30db4bf232f..b896dc955e6 100755 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -250,3 +250,4 @@ PriceExpressionEditorHelp3=In both product/service and supplier prices there are PriceExpressionEditorHelp4=In product/service price only: #supplier_min_price#
In supplier prices only: #supplier_quantity# and #supplier_tva_tx# PriceMode=Price mode PriceNumeric=Number +DefaultPrice=Default price \ No newline at end of file diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6888bfb7b5d..f577c860511 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -7,7 +7,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Philippe Grand - * Copyright (C) 2014 Ion agorria + * Copyright (C) 2014 Ion agorria * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,11 +64,7 @@ $error=0; * Actions */ -if ($action == 'update_price' && GETPOST("cancel")) -{ - - $action=''; -} +if (GETPOST("cancel")) $action=''; if ($action == 'update_price' && ! GETPOST("cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { @@ -120,7 +116,7 @@ if ($action == 'update_price' && ! GETPOST("cancel") && ($user->rights->produit- } if ($newprice < $newprice_min && ! empty($object->fk_price_expression)) { - $newprice = $newprice_min; //Set price same as min, the user will not see the + $newprice = $newprice_min; //Set price same as min, the user will not see the } if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { @@ -640,13 +636,15 @@ print "\n"; print "\n"; + /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ -if (! $action || $action == 'delete') { +if (! $action || $action == 'delete') +{ print "\n" . '
' . "\n"; if ($user->rights->produit->creer || $user->rights->service->creer) { @@ -659,10 +657,12 @@ if (! $action || $action == 'delete') { /* * Edition du prix */ -if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { +if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer)) +{ print_fiche_titre($langs->trans("NewPrice"), '', ''); - if (empty($conf->global->PRODUIT_MULTIPRICES)) { + if (empty($conf->global->PRODUIT_MULTIPRICES)) + { print '
'; print ''; print ''; @@ -682,7 +682,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print $form->select_PriceBaseType($object->price_base_type, "price_base_type"); print ''; print ''; - + //Only show price mode and expression selector if module is enabled if (! empty($conf->dynamicprices->enabled)) { // Price mode selector @@ -755,8 +755,11 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print '
'; print '
'; - } else { - for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { + } + else + { + for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) + { print '
'; print ''; print ''; @@ -823,10 +826,12 @@ $sql .= " ORDER BY p.date_price DESC, p.price_level ASC"; // $sql .= $db->plimit(); $result = $db->query($sql); -if ($result) { +if ($result) +{ $num = $db->num_rows($result); - if (! $num) { + if (! $num) + { $db->free($result); // Il doit au moins y avoir la ligne de prix initial. @@ -837,9 +842,12 @@ if ($result) { $num = $db->num_rows($result); } - if ($num > 0) { + if ($num > 0) + { print '
'; + if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_fiche_titre($langs->trans("DefaultPrice"),'',''); + print ''; print ''; @@ -868,7 +876,8 @@ if ($result) { $var = True; $i = 0; - while ($i < $num) { + while ($i < $num) + { $objp = $db->fetch_object($result); $var = ! $var; print ""; @@ -936,7 +945,9 @@ if ($result) { dol_print_error($db); } -if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + +if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) +{ $prodcustprice = new Productcustomerprice($db); @@ -962,8 +973,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $filter ['soc.nom'] = $search_soc; } - if ($action == 'add_customer_price') { - + if ($action == 'add_customer_price') + { // Create mode $maxpricesupplier = $object->min_recommended_price(); @@ -1040,8 +1051,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print '
'; - } elseif ($action == 'edit_customer_price') { - + } + elseif ($action == 'edit_customer_price') + { // Edit mode $maxpricesupplier = $object->min_recommended_price(); @@ -1125,7 +1137,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print '
'; - } elseif ($action == 'showlog_customer_price') { + } + elseif ($action == 'showlog_customer_price') + { $filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int')); @@ -1198,8 +1212,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n" . '
' . "\n"; print ''; print "\n

\n"; - } else { - + } + else + { // View mode // Count total nb of records @@ -1215,42 +1230,42 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $option = '&search_soc=' . $search_soc . '&id=' . $object->id; - print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); + print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords, ''); + + print ''; + print ''; + + print '
'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + // Print the search button + print ''; + print ''; if (count($prodcustprice->lines) > 0) { - print ''; - print ''; - - print '
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
 '; + print ''; + print '
'; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - // Print the search button - print ''; - print ''; - $var = True; foreach ($prodcustprice->lines as $line) { - print ""; + print ""; // Date $staticsoc = new Societe($db); $staticsoc->fetch($line->fk_soc); @@ -1290,13 +1305,16 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n"; } - print "
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
 '; - print ''; - print '
"; - - print ""; } else { - print $langs->trans('None'); + $colspan=9; + if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1; + print ''.$langs->trans('None').''; } + print ""; + + print ""; + /* ************************************************************************** */ /* */ /* Barre d'action */