Fix: Avoid call method on non object error
This commit is contained in:
parent
4d527d26af
commit
73de8d169f
@ -185,11 +185,11 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
$array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $array_thirdparty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
@ -201,7 +201,7 @@ abstract class CommonDocGenerator
|
||||
function get_substitutionarray_propal($object,$outputlangs,$array_key='object')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$array_propal=array(
|
||||
$array_key.'_id'=>$object->id,
|
||||
$array_key.'_ref'=>$object->ref,
|
||||
@ -224,14 +224,14 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_note_private'=>$object->note,
|
||||
$array_key.'_note'=>$object->note_public,
|
||||
);
|
||||
|
||||
|
||||
// Add vat by rates
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if (empty($array_propal[$array_key.'_total_vat_'.$line->tva_tx])) $array_propal[$array_key.'_total_vat_'.$line->tva_tx]=0;
|
||||
$array_propal[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
}
|
||||
|
||||
|
||||
// Retrieve extrafields
|
||||
if(is_array($object->array_options) && count($object->array_options))
|
||||
{
|
||||
@ -240,12 +240,12 @@ abstract class CommonDocGenerator
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('propal',true);
|
||||
$object->fetch_optionals($object->id,$extralabels);
|
||||
|
||||
|
||||
$array_propal = $this->fill_substitutionarray_with_extrafields($object,$array_propal,$extrafields,$array_key,$outputlangs);
|
||||
}
|
||||
return $array_propal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
@ -257,7 +257,7 @@ abstract class CommonDocGenerator
|
||||
function get_substitutionarray_propal_lines($line,$outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
return array(
|
||||
'line_fulldesc'=>doc_getlinedesc($line,$outputlangs),
|
||||
'line_product_ref'=>$line->product_ref,
|
||||
@ -274,7 +274,7 @@ abstract class CommonDocGenerator
|
||||
'line_date_end'=>$line->date_end
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fill array with couple extrafield key => extrafield value
|
||||
*
|
||||
@ -309,14 +309,14 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
$object->array_options['options_'.$key] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):'');
|
||||
}
|
||||
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
||||
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
||||
}
|
||||
|
||||
|
||||
return $array_to_fill;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rect pdf
|
||||
*
|
||||
|
||||
@ -139,7 +139,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
if (empty($resarray['object_total_vat_'.$line->tva_tx])) $resarray['object_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray['object_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
}
|
||||
|
||||
|
||||
// Retrieve extrafields
|
||||
if(is_array($object->array_options) && count($object->array_options))
|
||||
{
|
||||
@ -148,7 +148,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('facture',true);
|
||||
$object->fetch_optionals($object->id,$extralabels);
|
||||
|
||||
|
||||
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key='object',$outputlangs);
|
||||
}
|
||||
return $resarray;
|
||||
@ -358,14 +358,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
{
|
||||
$socobject=$object->client;
|
||||
}
|
||||
|
||||
|
||||
// Fetch info for linked propal
|
||||
$linked_propal = $object->fetchObjectLinked('','','','');
|
||||
print '<pre>';
|
||||
//print_r($object->linkedObjects['propal']); exit;
|
||||
|
||||
$propal_object = $object->linkedObjects['propal'][0];
|
||||
|
||||
|
||||
// Make substitution
|
||||
$substitutionarray=array(
|
||||
'__FROM_NAME__' => $this->emetteur->nom,
|
||||
@ -415,7 +415,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_propal=$this->get_substitutionarray_propal($propal_object,$outputlangs,'propal');
|
||||
$array_propal=is_object($propal_object)?$this->get_substitutionarray_propal($propal_object,$outputlangs,'propal'):array();
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user