Fix: get special code of parent line
This commit is contained in:
parent
80457eedf1
commit
c5307243c8
@ -1340,6 +1340,22 @@ class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get special code of line
|
||||||
|
* @param lineid Id of line
|
||||||
|
*/
|
||||||
|
function getSpecialCode($lineid)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||||
|
$sql.= ' WHERE rowid = '.$lineid;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
return $row[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -239,7 +239,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
|
|
||||||
// Description de la ligne produit
|
// Description de la ligne produit
|
||||||
$curX = $this->posxdesc-1;
|
$curX = $this->posxdesc-1;
|
||||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY);
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,GETPOST('hideref'),GETPOST('hidedesc'));
|
||||||
|
|
||||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|||||||
@ -653,12 +653,11 @@ 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) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
return $object->hooks[$object->lines[$i]->special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref,$hidedesc,$issupplierline);
|
return $object->hooks[$special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref,$hidedesc,$issupplierline);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -724,7 +723,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
{
|
{
|
||||||
if ($idprod)
|
if ($idprod)
|
||||||
{
|
{
|
||||||
if (empty($hidedesc)) $libelleproduitservice.=$desc;
|
if ( empty($hidedesc) ) $libelleproduitservice.=$desc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -753,7 +752,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$hideref)
|
if ( empty($hideref) )
|
||||||
{
|
{
|
||||||
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
|
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
|
||||||
else $ref_prodserv = $prodser->ref; // Show local ref only
|
else $ref_prodserv = $prodser->ref; // Show local ref only
|
||||||
@ -813,10 +812,9 @@ function pdf_getlinenum($object,$i,$outputlangs)
|
|||||||
{
|
{
|
||||||
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->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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -835,10 +833,9 @@ function pdf_getlineref($object,$i,$outputlangs)
|
|||||||
{
|
{
|
||||||
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->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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
// TODO add hook function
|
// TODO add hook function
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -852,14 +849,13 @@ function pdf_getlineref($object,$i,$outputlangs)
|
|||||||
* @param $i Current line number
|
* @param $i Current line number
|
||||||
* @param outputlang Object lang for output
|
* @param outputlang Object lang for output
|
||||||
*/
|
*/
|
||||||
function pdf_getlinevatrate($object,$i,$outputlangs)
|
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
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->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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
// TODO add hook function
|
return $object->hooks[$special_code]->pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -873,14 +869,13 @@ function pdf_getlinevatrate($object,$i,$outputlangs)
|
|||||||
* @param $i Current line number
|
* @param $i Current line number
|
||||||
* @param outputlang Object lang for output
|
* @param outputlang Object lang for output
|
||||||
*/
|
*/
|
||||||
function pdf_getlineupexcltax($object,$i,$outputlangs)
|
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
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->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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
// TODO add hook function
|
return $object->hooks[$special_code]->pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -894,16 +889,15 @@ function pdf_getlineupexcltax($object,$i,$outputlangs)
|
|||||||
* @param $i Current line number
|
* @param $i Current line number
|
||||||
* @param outputlang Object lang for output
|
* @param outputlang Object lang for output
|
||||||
*/
|
*/
|
||||||
function pdf_getlineqty($object,$i,$outputlangs)
|
function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
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) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
|
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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
// TODO add hook function
|
return $object->hooks[$special_code]->pdf_getlineqty($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -918,7 +912,7 @@ function pdf_getlineqty($object,$i,$outputlangs)
|
|||||||
* @param $i Current line number
|
* @param $i Current line number
|
||||||
* @param outputlang Object lang for output
|
* @param outputlang Object lang for output
|
||||||
*/
|
*/
|
||||||
function pdf_getlineremisepercent($object,$i,$outputlangs)
|
function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
include_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
include_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||||
|
|
||||||
@ -926,10 +920,9 @@ function pdf_getlineremisepercent($object,$i,$outputlangs)
|
|||||||
{
|
{
|
||||||
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->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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
// TODO add hook function
|
return $object->hooks[$special_code]->pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -944,7 +937,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs)
|
|||||||
* @param $i Current line number
|
* @param $i Current line number
|
||||||
* @param outputlang Object lang for output
|
* @param outputlang Object lang for output
|
||||||
*/
|
*/
|
||||||
function pdf_getlinetotalexcltax($object,$i,$outputlangs)
|
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
|
||||||
{
|
{
|
||||||
if ($object->lines[$i]->special_code == 3)
|
if ($object->lines[$i]->special_code == 3)
|
||||||
{
|
{
|
||||||
@ -954,10 +947,9 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs)
|
|||||||
{
|
{
|
||||||
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->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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||||
return $object->hooks[$object->lines[$i]->special_code]->pdf_getlinetotalexcltax($object,$i,$outputlangs);
|
return $object->hooks[$special_code]->pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -988,10 +980,9 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
|
|||||||
}
|
}
|
||||||
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) ) )
|
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))
|
$special_code = $object->lines[$i]->special_code;
|
||||||
{
|
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($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)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user