FIX pdf for creating invoice without massaction

This commit is contained in:
atm-quentin 2018-10-17 15:36:47 +02:00
parent 236a61ab55
commit dd0a57d39e
5 changed files with 22 additions and 17 deletions

View File

@ -387,14 +387,22 @@ class pdf_canelle_reception extends ModelePDFSuppliersInvoices
// Reception
$reception_content = '';
$object->lines[$i]->fetchObjectLinked();
if (!empty($object->lines[$i]->linkedObjects['reception']))
{
$reception = array_shift($object->lines[$i]->linkedObjects['reception']);
$reception_content = $reception->ref.' du '.date('d/m/Y', $reception->date_delivery);
if(!empty($object->linkedObjects['reception'])){
if(count($object->linkedObjects['reception']) == 1){
$reception = array_shift($object->linkedObjects['reception']);
$reception_content = $reception->ref.' du '.date('d/m/Y', $reception->date_delivery);
}else {
$object->lines[$i]->fetchObjectLinked();
if (!empty($object->lines[$i]->linkedObjects['reception']))
{
$reception = array_shift($object->lines[$i]->linkedObjects['reception']);
$reception_content = $reception->ref.' du '.date('d/m/Y', $reception->date_delivery);
}
}
}
$pdf->SetXY($this->posxreception-5, $curY);
$pdf->MultiCell($this->posxtva-$this->posxreception+4, 3, $reception_content, 0, 'R');

View File

@ -1363,12 +1363,11 @@ class FactureFournisseur extends CommonInvoice
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param int $origin_id id origin document
* @param double $pu_ht_devise Amount in currency
* @param string $ref_supplier Supplier ref
* @return int >0 if OK, <0 if KO
*
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
*/
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0,$ref_supplier='')
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0)
{
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';

View File

@ -710,7 +710,7 @@ if (empty($reshook))
$lines[$i]->fk_unit,
$lines[$i]->id
);
if ($result < 0)
{
$error++;

View File

@ -1860,7 +1860,7 @@ else if ($id || $ref)
}
else
{
print '<td style="white-space: pre;" >'.$lines[$i]->comment.'</td>';
print '<td style="white-space: pre-wrap;max-width: 200px;" >'.$lines[$i]->comment.'</td>';
}

View File

@ -263,16 +263,14 @@ class Reception extends CommonObject
$num=count($this->lines);
for ($i = 0; $i < $num; $i++)
{
if (! isset($this->lines[$i]->detail_batch))
{
$this->lines[$i]->fk_reception = $this->id;
$this->lines[$i]->fk_reception = $this->id;
if (! $this->lines[$i]->create($user) > 0)
{
$error++;
}
if (! $this->lines[$i]->create($user) > 0)
{
$error++;
}
}
if (! $error && $this->id && $this->origin_id)