From a5c3658f532cf70a039ee8e82fb381e003d25058 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Feb 2016 02:44:34 +0100 Subject: [PATCH 1/7] Fix bad formatting of order / shipment ref on PDF --- htdocs/core/lib/pdf.lib.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 34ff6103f11..c6df0040e4e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -364,6 +364,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali return $outputlangs->convToOutputCharset($socname); } + /** * Return a string with full address formated * @@ -1881,7 +1882,8 @@ function pdf_getLinkedObjects($object,$outputlangs) foreach($objects as $elementobject) { $elementobject->fetchObjectLinked(); - $order = $elementobject->linkedObjects['commande'][0]; + + $order = reset($elementobject->linkedObjects['commande']); if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment { @@ -1895,9 +1897,9 @@ function pdf_getLinkedObjects($object,$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.')' : ''); $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); - $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); + $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'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ($elementobject->date_delivery ? ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs) : ''); } } } From 59a6cb5f5534b2f48f90937afdd988681a85c21f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Feb 2016 03:04:36 +0100 Subject: [PATCH 2/7] Fix bad support of option WORKFLOW_BILL_ON_SHIPMENT Conflicts: htdocs/commande/list.php --- htdocs/commande/list.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index fda90bf4056..9de719a9e9d 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -42,6 +42,7 @@ $langs->load('orders'); $langs->load('deliveries'); $langs->load('companies'); $langs->load('compta'); +$langs->load('bills'); $orderyear=GETPOST("orderyear","int"); $ordermonth=GETPOST("ordermonth","int"); @@ -337,7 +338,7 @@ if ($resql) $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Billed'),$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); + if (empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) print_liste_field_titre($langs->trans('Billed'),$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); print ''; @@ -377,9 +378,12 @@ if ($resql) ); print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); print ''; - print ''; - print $form->selectyesno('billed', $billed, 1, 0, 1); - print ''; + if (empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) + { + print ''; + print $form->selectyesno('billed', $billed, 1, 0, 1); + print ''; + } print ''; print ''; print "\n"; @@ -588,7 +592,7 @@ if ($resql) print ''.$generic_commande->LibStatut($objp->fk_statut, $objp->billed, 5, 1).''; // Billed - print ''.yn($objp->billed).''; + if (empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) print ''.yn($objp->billed).''; print ''; From cdcad62967cfd6c7988c98a634a6c62d9f27169f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Feb 2016 18:18:00 +0100 Subject: [PATCH 3/7] FIX Array of linked elements for PDF contains duplicates and missing data --- htdocs/core/lib/pdf.lib.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c6df0040e4e..a4d5a734472 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1838,10 +1838,10 @@ function pdf_getLinkedObjects($object,$outputlangs) $linkedobjects=array(); $object->fetchObjectLinked(); - + foreach($object->linkedObjects as $objecttype => $objects) { - if ($objecttype == 'propal') + if ($objecttype == 'propal') { $outputlangs->load('propal'); @@ -1879,26 +1879,28 @@ function pdf_getLinkedObjects($object,$outputlangs) { $outputlangs->load('orders'); $outputlangs->load('sendings'); - foreach($objects as $elementobject) + foreach($objects as $x => $elementobject) { $elementobject->fetchObjectLinked(); - + $order = reset($elementobject->linkedObjects['commande']); - if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment + // We concat this record info into fields xxx_value. title is overwrote. + if (! empty($object->linkedObjects['commande']) || $object->element == 'commande') // There is already a link to order or object is the order, so we show only info of shipment { $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"); $linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } - else // We show both info of order and shipment + 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.')' : ''); + 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") : ''); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); + 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) : ''); } } From b072b5a1815295111c7b835073946e6abb793dd9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2016 10:38:42 +0100 Subject: [PATCH 4/7] Fix remove some warnings Conflicts: htdocs/core/lib/pdf.lib.php --- htdocs/core/class/commonobject.class.php | 6 ++-- htdocs/core/lib/pdf.lib.php | 39 ++++++++++++------------ 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 743b26ecc67..5f41976236c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -768,9 +768,10 @@ abstract class CommonObject * @param int $statut Status of links to get (-1=all) * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param int $list 0:Return array contains all properties, 1:Return array contains just id + * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array Array of contacts */ - function liste_contact($statut=-1,$source='external',$list=0) + function liste_contact($statut=-1,$source='external',$list=0,$code='') { global $langs; @@ -788,6 +789,7 @@ abstract class CommonObject $sql.= " WHERE ec.element_id =".$this->id; $sql.= " AND ec.fk_c_type_contact=tc.rowid"; $sql.= " AND tc.element='".$this->element."'"; + if ($code) $sql.= " AND tc.code = '".$this->db->escape($code)."'"; if ($source == 'internal') $sql.= " AND tc.source = 'internal'"; if ($source == 'external' || $source == 'thirdparty') $sql.= " AND tc.source = 'external'"; $sql.= " AND tc.active=1"; @@ -825,7 +827,7 @@ abstract class CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); dol_print_error($this->db); return -1; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index a4d5a734472..ad584e21d86 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1879,29 +1879,30 @@ function pdf_getLinkedObjects($object,$outputlangs) { $outputlangs->load('orders'); $outputlangs->load('sendings'); - foreach($objects as $x => $elementobject) + foreach($objects as $elementobject) { $elementobject->fetchObjectLinked(); - - $order = reset($elementobject->linkedObjects['commande']); - // We concat this record info into fields xxx_value. title is overwrote. - if (! empty($object->linkedObjects['commande']) || $object->element == 'commande') // There is already a link to order or object is the order, so we show only info of shipment + if (isset($elementobject->linkedObjects['commande']) && count($elementobject->linkedObjects['commande']) > 0) { - $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"); - $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"); - 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) : ''); + $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) : ''); + } } } } From 7567336680653dee460e4651bb3cae74b4ed69ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2016 10:51:06 +0100 Subject: [PATCH 5/7] FIX #4683 --- htdocs/compta/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a680886827a..3855e2525c4 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -448,7 +448,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 '; @@ -527,7 +527,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'; @@ -810,7 +810,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 ''; From 2e25c7969b4b3dc1d9f809c1f7ae3562d1c14110 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2016 12:22:32 +0100 Subject: [PATCH 6/7] Fix when setting a price for a product, selection of product must not show any price --- htdocs/core/class/html.form.class.php | 31 +++++++++++++++------------ 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 73b401025e9..be1bfc0c7fc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1834,14 +1834,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; @@ -1888,7 +1889,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"; @@ -1929,7 +1930,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; @@ -1954,20 +1955,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') @@ -1989,7 +1992,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') { From 4250fe155ac46b9b146c9d655e62f1ca2eb82c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2016 15:42:07 +0100 Subject: [PATCH 7/7] Fix showing ref of shipment on orders (lines too long) --- htdocs/core/lib/pdf.lib.php | 50 +++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ad584e21d86..09c8acb5b38 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1879,31 +1879,33 @@ function pdf_getLinkedObjects($object,$outputlangs) { $outputlangs->load('orders'); $outputlangs->load('sendings'); - foreach($objects as $elementobject) + foreach($objects as $x => $elementobject) { - $elementobject->fetchObjectLinked(); - - if (isset($elementobject->linkedObjects['commande']) && count($elementobject->linkedObjects['commande']) > 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) : ''); + } } } }