diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index fb4379f5e1a..ecf9fb5ddbd 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -283,6 +283,7 @@ PriceExpressionEditorHelp5=Available global values:
PriceMode=Price mode
PriceNumeric=Number
DefaultPrice=Default price
+DefaultPriceLog=Log of previous default prices
ComposedProductIncDecStock=Increase/Decrease stock on parent change
ComposedProduct=Child products
MinSupplierPrice=Minimum buying price
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 98c4084587c..55cc67de4a5 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1622,7 +1622,7 @@ class Product extends CommonObject
*
* @param Societe $thirdparty_seller Seller
* @param Societe $thirdparty_buyer Buyer
- * @param int $pqp Id of product per price if a selection was done of such a price
+ * @param int $pqp Id of product price per quantity if a selection was done of such a price
* @return array Array of price information array('pu_ht'=> , 'pu_ttc'=> , 'tva_tx'=>'X.Y (code)', ...), 'tva_npr'=>0, ...)
* @see get_buyprice(), find_min_price_product_fournisseur()
*/
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 1bf94b28cde..6fa2a77d5da 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -1466,9 +1466,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
{
// Default prices or
// Log of previous customer prices
- $backbutton = 'id.'">'.$langs->trans("Back").' ';
+ $backbutton = 'id.'">'.$langs->trans("Back").' ';
- if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, 0, $num, 'title_accountancy.png');
+ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPriceLog"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, 0, $num, 'title_accountancy.png');
else print_barre_liste($langs->trans("PriceByCustomerLog"), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, $num, 'title_accountancy.png');
//if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png');
//else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png');
@@ -2100,7 +2100,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print img_info($langs->trans('PriceByCustomerLog'));
print '';
print ' ';
- print 'id.'">';
+ print ' id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"');
print ' ';
print ' ';
@@ -2186,11 +2186,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print img_info($langs->trans('PriceByCustomerLog'));
print '';
print ' ';
- print 'id.'&lineid='.$line->id.'">';
+ print ' id.'&lineid='.$line->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"');
print ' ';
print ' ';
- print 'id.'&lineid='.$line->id.'">';
+ print ' id.'&lineid='.$line->id.'">';
print img_delete('default', 'style="vertical-align: middle;"');
print ' ';
print '';
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index c0adf0984cc..4a5d484abf8 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -363,13 +363,9 @@ if ($action == 'confirm_generateinvoice')
{
if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
-
- if (!($projectstatic->thirdparty->id > 0))
- {
+ if (!($projectstatic->thirdparty->id > 0)) {
setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors');
- }
- else
- {
+ } else {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -403,6 +399,7 @@ if ($action == 'confirm_generateinvoice')
$prodDurationHours *= $tmpproduct->duration_value;
$dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0);
+
$pu_ht = empty($dataforprice['pu_ht']) ? 0 : $dataforprice['pu_ht'];
$txtva = $dataforprice['tva_tx'];
$localtax1 = $dataforprice['localtax1'];
@@ -962,69 +959,80 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print ' ';
print ' ';
+ // Form to convert time spent into invoice
if ($massaction == 'generateinvoice')
{
- //var_dump($_REQUEST);
print ' ';
- print '
';
- print '';
- print '';
- print $langs->trans('DateInvoice');
- print ' ';
- print '';
- print $form->selectDate('', '', '', '', '', '', 1, 1);
- print ' ';
- print ' ';
- print '';
- print '';
- print $langs->trans('Mode');
- print ' ';
- print '';
- $tmparray = array(
- 'onelineperuser'=>'OneLinePerUser',
- 'onelinepertask'=>'OneLinePerTask',
- 'onelineperperiod'=>'OneLinePerPeriod',
- );
- print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
- print ' ';
- print ' ';
- if ($conf->service->enabled)
- {
+ if ($projectstatic->thirdparty->id > 0) {
+ print '';
print '';
- print '';
- print $langs->trans('ServiceToUseOnLines');
+ print ' ';
+ print $langs->trans('DateInvoice');
print ' ';
print '';
- $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500');
+ print $form->selectDate('', '', '', '', '', '', 1, 1);
print ' ';
print ' ';
- }
- print '';
- print '';
- print $langs->trans('InvoiceToUse');
- print ' ';
- print '';
- $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'),
- 1, 0, 0, 'maxwidth500', '', 'all');
- print ' ';
- print ' ';
- /*print '';
- print '';
- print $langs->trans('ValidateInvoices');
- print ' ';
- print '';
- print $form->selectyesno('validate_invoices', 0, 1);
- print ' ';
- print ' ';*/
- print '
';
- print ' ';
- print '';
- print ' ';
- print ' ';
- print '
';
- print ' ';
+ print '';
+ print '';
+ print $langs->trans('Mode');
+ print ' ';
+ print '';
+ $tmparray = array(
+ 'onelineperuser'=>'OneLinePerUser',
+ 'onelinepertask'=>'OneLinePerTask',
+ 'onelineperperiod'=>'OneLinePerPeriod',
+ );
+ print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
+ print ' ';
+ print ' ';
+
+ if ($conf->service->enabled)
+ {
+ print '';
+ print '';
+ print $langs->trans('ServiceToUseOnLines');
+ print ' ';
+ print '';
+ $form->select_produits('', 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500');
+ print ' ';
+ print ' ';
+ }
+
+ print '';
+ print '';
+ print $langs->trans('InvoiceToUse');
+ print ' ';
+ print '';
+ $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'),
+ 1, 0, 0, 'maxwidth500', '', 'all');
+ print ' ';
+ print ' ';
+ /*print '';
+ print '';
+ print $langs->trans('ValidateInvoices');
+ print ' ';
+ print '';
+ print $form->selectyesno('validate_invoices', 0, 1);
+ print ' ';
+ print ' ';*/
+ print '
';
+
+ print ' ';
+ print '';
+ print ' ';
+ print ' ';
+ print '
';
+ print ' ';
+ } else {
+ print ''.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'
';
+ print '';
+ print ' ';
+ print '
';
+ $massaction = '';
+ }
}
/*
@@ -1118,7 +1126,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
}
/*
- * Form to add time spent
+ * Form to add a new line of time spent
*/
if ($action == 'createtime' && $user->rights->projet->lire)
{