Merge remote-tracking branch 'origin/3.9' into develop

Conflicts:
	htdocs/commande/list.php
	htdocs/core/lib/pdf.lib.php
This commit is contained in:
Laurent Destailleur 2016-02-26 15:45:25 +01:00
commit 23f45c7b7e
3 changed files with 47 additions and 42 deletions

View File

@ -577,7 +577,7 @@ $facturestatic=new Facture($db);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_tva, f.total_ttc,'; $sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' s.nom as name, s.rowid as socid, s.code_client, s.client '; $sql.= ' s.nom as name, s.rowid as socid, s.code_client, s.client ';
@ -656,7 +656,7 @@ if ($search_user > 0)
} }
if (! $sall) if (! $sall)
{ {
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.increment, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid, s.code_client, s.client'; $sql.= ' s.nom, s.rowid, s.code_client, s.client';
@ -941,7 +941,7 @@ if ($resql)
$facturestatic->type=$objp->type; $facturestatic->type=$objp->type;
$facturestatic->statut=$objp->fk_statut; $facturestatic->statut=$objp->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($objp->datelimite); $facturestatic->date_lim_reglement=$db->jdate($objp->datelimite);
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$objp->note_public:$objp->note),1); $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$objp->note_public:$objp->note_private),1);
$paiement = $facturestatic->getSommePaiement(); $paiement = $facturestatic->getSommePaiement();
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';

View File

@ -1835,14 +1835,15 @@ class Form
/** /**
* constructProductListOption * constructProductListOption
* *
* @param resultset $objp Resultset of fetch * @param resultset $objp Resultset of fetch
* @param string $opt Option * @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option * @param string $optJson Option (var used for returned value in json format)
* @param int $price_level Price level * @param int $price_level Price level
* @param string $selected Preselected value * @param string $selected Preselected value
* @param int $hidepriceinlabel Hide price in label
* @return void * @return void
*/ */
private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected) private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel=0)
{ {
global $langs,$conf,$user,$db; global $langs,$conf,$user,$db;
@ -1891,7 +1892,7 @@ class Form
$found=0; $found=0;
// Multiprice // Multiprice
if ($price_level >= 1 && $conf->global->PRODUIT_MULTIPRICES) // If we need a particular price level (from 1 to 6) if (empty($hidepriceinlabel) && $price_level >= 1 && $conf->global->PRODUIT_MULTIPRICES) // If we need a particular price level (from 1 to 6)
{ {
$sql = "SELECT price, price_ttc, price_base_type, tva_tx"; $sql = "SELECT price, price_ttc, price_base_type, tva_tx";
$sql.= " FROM ".MAIN_DB_PREFIX."product_price"; $sql.= " FROM ".MAIN_DB_PREFIX."product_price";
@ -1932,7 +1933,7 @@ class Form
} }
// Price by quantity // Price by quantity
if (!empty($objp->quantity) && $objp->quantity >= 1 && ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1 && ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY))
{ {
$found = 1; $found = 1;
$outqty=$objp->quantity; $outqty=$objp->quantity;
@ -1957,20 +1958,22 @@ class Form
$outpricebasetype=$objp->price_base_type; $outpricebasetype=$objp->price_base_type;
$outtva_tx=$objp->tva_tx; $outtva_tx=$objp->tva_tx;
} }
if (!empty($objp->quantity) && $objp->quantity >= 1) if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1)
{ {
$opt.=" (".price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding $opt.=" (".price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outval.=" (".price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding $outval.=" (".price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
} }
if (!empty($objp->remise_percent) && $objp->remise_percent >= 1) if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1)
{ {
$opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; $opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
$outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; $outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
} }
//Price by customer // Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES))
if (!empty($objp->idprodcustprice)) { {
if (!empty($objp->idprodcustprice))
{
$found = 1; $found = 1;
if ($objp->custprice_base_type == 'HT') if ($objp->custprice_base_type == 'HT')
@ -1992,7 +1995,7 @@ class Form
} }
// If level no defined or multiprice not found, we used the default price // If level no defined or multiprice not found, we used the default price
if (! $found) if (empty($hidepriceinlabel) && ! $found)
{ {
if ($objp->price_base_type == 'HT') if ($objp->price_base_type == 'HT')
{ {

View File

@ -1873,7 +1873,7 @@ function pdf_getLinkedObjects($object,$outputlangs)
$linkedobjects=array(); $linkedobjects=array();
$object->fetchObjectLinked(); $object->fetchObjectLinked();
foreach($object->linkedObjects as $objecttype => $objects) foreach($object->linkedObjects as $objecttype => $objects)
{ {
if ($objecttype == 'facture') if ($objecttype == 'facture')
@ -1918,31 +1918,33 @@ function pdf_getLinkedObjects($object,$outputlangs)
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
$outputlangs->load('sendings'); $outputlangs->load('sendings');
foreach($objects as $elementobject) foreach($objects as $x => $elementobject)
{ {
$elementobject->fetchObjectLinked(); $order=null;
// We concat this record info into fields xxx_value. title is overwrote.
if (count($elementobject->linkedObjects) > 0) if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
{ {
$order = reset($elementobject->linkedObjects['commande']); // Get first order $elementobject->fetchObjectLinked();
if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']);
if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment }
{ if (! is_object($order))
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); {
$linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'].=' / ';
$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref);
} //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending");
else // We show both info of order and shipment //if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / ';
{ //$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); }
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); else
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); {
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateSending") : ''); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['date_value'].= ($elementobject->date_delivery ? ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs) : ''); $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref);
} //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateSending") : '');
} //if (empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
//$linkedobjects[$objecttype]['date_value'].= ($elementobject->date_delivery ? ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs) : '');
}
} }
} }
} }