2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2020-11-01 15:20:33 +01:00
parent 63a03cdad6
commit 45f834cb15
4 changed files with 75 additions and 66 deletions

View File

@@ -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

View File

@@ -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()
*/

View File

@@ -1466,9 +1466,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
{
// Default prices or
// Log of previous customer prices
$backbutton = '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("Back").'</a>';
$backbutton = '<a class="justalink" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("Back").'</a>';
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 '</a>';
print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit_price&amp;id='.$object->id.'">';
print '<a class="marginleftonly editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_price&amp;id='.$object->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"');
print '</a>';
print ' &nbsp; ';
@@ -2186,11 +2186,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print img_info($langs->trans('PriceByCustomerLog'));
print '</a>';
print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&amp;id='.$object->id.'&amp;lineid='.$line->id.'">';
print '<a class="marginleftonly editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit_customer_price&amp;id='.$object->id.'&amp;lineid='.$line->id.'">';
print img_edit('default', 0, 'style="vertical-align: middle;"');
print '</a>';
print ' ';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&amp;id='.$object->id.'&amp;lineid='.$line->id.'">';
print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?action=delete_customer_price&amp;id='.$object->id.'&amp;lineid='.$line->id.'">';
print img_delete('default', 'style="vertical-align: middle;"');
print '</a>';
print '</td>';

View File

@@ -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,11 +959,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="tab" value="'.$tab.'">';
// Form to convert time spent into invoice
if ($massaction == 'generateinvoice')
{
//var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">';
if ($projectstatic->thirdparty->id > 0) {
print '<table class="noborder" width="100%" >';
print '<tr>';
print '<td class="titlefield">';
@@ -976,6 +974,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print $form->selectDate('', '', '', '', '', '', 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('Mode');
@@ -989,6 +988,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
print '</td>';
print '</tr>';
if ($conf->service->enabled)
{
print '<tr>';
@@ -996,10 +996,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print $langs->trans('ServiceToUseOnLines');
print '</td>';
print '<td>';
$form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500');
$form->select_produits('', 'productid', '1', 0, $projectstatic->thirdparty->price_level, 1, 2, '', 0, array(), $projectstatic->thirdparty->id, 'None', 0, 'maxwidth500');
print '</td>';
print '</tr>';
}
print '<tr>';
print '<td class="titlefield">';
print $langs->trans('InvoiceToUse');
@@ -1025,6 +1026,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</div>';
print '<br>';
} else {
print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'</div>';
print '<div class="center">';
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</div>';
$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)
{