Fix: use hook function for product with fk_parent_line
This commit is contained in:
parent
be9c6d2d66
commit
638ad5abcf
@ -653,10 +653,13 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
|
|||||||
{
|
{
|
||||||
global $db, $conf, $langs;
|
global $db, $conf, $langs;
|
||||||
|
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
return $object->hooks[$object->lines[$i]->special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy);
|
return $object->hooks[$object->lines[$i]->special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline);
|
$labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline);
|
||||||
@ -808,10 +811,13 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
*/
|
*/
|
||||||
function pdf_getlinenum($object,$i,$outputlangs)
|
function pdf_getlinenum($object,$i,$outputlangs)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return dol_htmlentitiesbr($object->lines[$i]->num);
|
return dol_htmlentitiesbr($object->lines[$i]->num);
|
||||||
@ -827,10 +833,13 @@ function pdf_getlinenum($object,$i,$outputlangs)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlineref($object,$i,$outputlangs)
|
function pdf_getlineref($object,$i,$outputlangs)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return dol_htmlentitiesbr($object->lines[$i]->ref);
|
return dol_htmlentitiesbr($object->lines[$i]->ref);
|
||||||
@ -845,10 +854,13 @@ function pdf_getlineref($object,$i,$outputlangs)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlinevatrate($object,$i,$outputlangs)
|
function pdf_getlinevatrate($object,$i,$outputlangs)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits);
|
return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits);
|
||||||
@ -863,10 +875,13 @@ function pdf_getlinevatrate($object,$i,$outputlangs)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlineupexcltax($object,$i,$outputlangs)
|
function pdf_getlineupexcltax($object,$i,$outputlangs)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return price($object->lines[$i]->subprice);
|
return price($object->lines[$i]->subprice);
|
||||||
@ -883,10 +898,13 @@ function pdf_getlineqty($object,$i,$outputlangs)
|
|||||||
{
|
{
|
||||||
if ($object->lines[$i]->special_code != 3)
|
if ($object->lines[$i]->special_code != 3)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $object->lines[$i]->qty;
|
return $object->lines[$i]->qty;
|
||||||
@ -903,12 +921,16 @@ function pdf_getlineqty($object,$i,$outputlangs)
|
|||||||
function pdf_getlineremisepercent($object,$i,$outputlangs)
|
function pdf_getlineremisepercent($object,$i,$outputlangs)
|
||||||
{
|
{
|
||||||
include_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
include_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||||
|
|
||||||
if ($object->lines[$i]->special_code != 3)
|
if ($object->lines[$i]->special_code != 3)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
|
return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
|
||||||
@ -930,10 +952,13 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return price($object->lines[$i]->total_ht);
|
return price($object->lines[$i]->total_ht);
|
||||||
@ -961,10 +986,13 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
|
|||||||
{
|
{
|
||||||
$total += $object->lines[$i]->qty;
|
$total += $object->lines[$i]->qty;
|
||||||
}
|
}
|
||||||
else if ($type==9 && !empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
else if ($type==9 && ! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
||||||
|
{
|
||||||
|
if (empty($object->lines[$i]->fk_parent_line))
|
||||||
{
|
{
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if ($type==0 && $object->lines[$i]->product_type == 0)
|
else if ($type==0 && $object->lines[$i]->product_type == 0)
|
||||||
{
|
{
|
||||||
$total += $object->lines[$i]->qty;
|
$total += $object->lines[$i]->qty;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user