it's a mess
This commit is contained in:
parent
e9f631d2e3
commit
6952084be3
@ -1865,11 +1865,11 @@ abstract class CommonObject
|
||||
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
|
||||
$targettype = (! empty($targettype) ? $targettype : $this->element);
|
||||
|
||||
if (empty($sourceid) && empty($targetid))
|
||||
/*if (empty($sourceid) && empty($targetid))
|
||||
{
|
||||
dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR);
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Links beetween objects are stored in this table
|
||||
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
|
||||
|
||||
@ -1585,55 +1585,52 @@ function pdf_getLinkedObjects($object,$outputlangs)
|
||||
if ($objecttype == 'propal')
|
||||
{
|
||||
$outputlangs->load('propal');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'commande')
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : '');
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '');
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'contrat')
|
||||
{
|
||||
$outputlangs->load('contracts');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
else if ($objecttype == 'shipping')
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
$outputlangs->load('sendings');
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
foreach($objects as $elementobject)
|
||||
{
|
||||
$objects[$i]->fetchObjectLinked();
|
||||
$order = $objects[$i]->linkedObjects['commande'][0];
|
||||
$elementobject->fetchObjectLinked();
|
||||
$order = $elementobject->linkedObjects['commande'][0];
|
||||
|
||||
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
|
||||
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
|
||||
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref);
|
||||
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref);
|
||||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs);
|
||||
$linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user