diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2bdc2f088b9..5a20364bd44 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -577,7 +577,7 @@ $facturestatic=new Facture($db); $sql = 'SELECT'; 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.paye as paye, f.fk_statut,'; $sql.= ' s.nom as name, s.rowid as socid, s.code_client, s.client '; @@ -656,7 +656,7 @@ if ($search_user > 0) } 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.paye, f.fk_statut,'; $sql.= ' s.nom, s.rowid, s.code_client, s.client'; @@ -941,7 +941,7 @@ if ($resql) $facturestatic->type=$objp->type; $facturestatic->statut=$objp->fk_statut; $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(); print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 55ac48b214a..df2041cc070 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1835,14 +1835,15 @@ class Form /** * constructProductListOption * - * @param resultset $objp Resultset of fetch - * @param string $opt Option - * @param string $optJson Option - * @param int $price_level Price level - * @param string $selected Preselected value + * @param resultset $objp Resultset of fetch + * @param string $opt Option (var used for returned value in string option format) + * @param string $optJson Option (var used for returned value in json format) + * @param int $price_level Price level + * @param string $selected Preselected value + * @param int $hidepriceinlabel Hide price in label * @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; @@ -1891,7 +1892,7 @@ class Form $found=0; // 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.= " FROM ".MAIN_DB_PREFIX."product_price"; @@ -1932,7 +1933,7 @@ class Form } // 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; $outqty=$objp->quantity; @@ -1957,20 +1958,22 @@ class Form $outpricebasetype=$objp->price_base_type; $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 $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).' %'; $outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; } - //Price by customer - if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - if (!empty($objp->idprodcustprice)) { + // Price by customer + if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + { + if (!empty($objp->idprodcustprice)) + { $found = 1; 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 (! $found) + if (empty($hidepriceinlabel) && ! $found) { if ($objp->price_base_type == 'HT') { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c7bdd9cd6b0..a952159b874 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1873,7 +1873,7 @@ function pdf_getLinkedObjects($object,$outputlangs) $linkedobjects=array(); $object->fetchObjectLinked(); - + foreach($object->linkedObjects as $objecttype => $objects) { if ($objecttype == 'facture') @@ -1918,31 +1918,33 @@ function pdf_getLinkedObjects($object,$outputlangs) { $outputlangs->load('orders'); $outputlangs->load('sendings'); - foreach($objects as $elementobject) + foreach($objects as $x => $elementobject) { - $elementobject->fetchObjectLinked(); - - if (count($elementobject->linkedObjects) > 0) - { - $order = reset($elementobject->linkedObjects['commande']); // Get first order - - if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment - { - $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); - $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref); - $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); - $linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); - } - else // We show both info of order and shipment - { - $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); - $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateSending") : ''); - $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) : ''); - } - } + $order=null; + // We concat this record info into fields xxx_value. title is overwrote. + 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 + { + $elementobject->fetchObjectLinked(); + if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); + } + if (! is_object($order)) + { + $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); + if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'].=' / '; + $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref); + //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); + //if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / '; + //$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); + } + else + { + $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); + if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); + $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) : ''); + } } } }