Start to introduce common substitution rules for odt substitutions
This commit is contained in:
parent
c8078b54b5
commit
38d1fc27e0
@ -349,8 +349,8 @@ abstract class CommonDocGenerator
|
||||
$array_key.'_id'=>$object->id,
|
||||
$array_key.'_ref'=>$object->ref,
|
||||
$array_key.'_ref_ext'=>$object->ref_ext,
|
||||
$array_key.'_ref_customer'=>$object->ref_client,
|
||||
$array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''),
|
||||
$array_key.'_ref_customer'=>(! empty($object->ref_client) ? $object->ref_client : (empty($object->ref_customer) ? '' : $object->ref_customer)),
|
||||
$array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur) ? $object->ref_fournisseur : (empty($object->ref_supplier) ? '' : $object->ref_supplier)),
|
||||
$array_key.'_source_invoice_ref'=>$invoice_source->ref,
|
||||
// Dates
|
||||
$array_key.'_hour'=>dol_print_date($object->date,'hour'),
|
||||
|
||||
@ -354,21 +354,22 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in order as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact)
|
||||
$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
// retrieve contact information for use in order as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
|
||||
$tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
||||
@ -296,26 +296,17 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
/* deprecated
|
||||
$substitutionarray['__FROM_NAME__'] = $this->emetteur->name;
|
||||
$substitutionarray['__FROM_EMAIL__'] = $this->emetteur->email;
|
||||
$substitutionarray['__TOTAL_TTC__'] = $object->total_ttc;
|
||||
$substitutionarray['__TOTAL_HT__'] = $object->total_ht;
|
||||
$substitutionarray['__TOTAL_VAT__'] = $object->total_vat;
|
||||
*/
|
||||
|
||||
// Make substitutions into ODT
|
||||
$array_contract=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs); // complete with vars not set as properties by get_substitutionarray_each_var_object
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in contract as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
|
||||
$substitutionarray = array_merge($substitutionarray,$array_contract,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
|
||||
$substitutionarray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
$tmparray = $substitutionarray;
|
||||
|
||||
@ -361,20 +361,22 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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=is_object($propal_object)?$this->get_substitutionarray_object($propal_object,$outputlangs,'propal'):array();
|
||||
$array_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in invoice as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact)
|
||||
$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
// retrieve contact information for use in invoice as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal,$array_other,$array_thirdparty_contact);
|
||||
$tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_propal,$array_other,$array_thirdparty_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
@ -95,7 +95,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
function info($langs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("errors");
|
||||
|
||||
@ -361,6 +361,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
$object->fetch_optionals();
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
try {
|
||||
@ -369,25 +370,26 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
catch(OdfException $e)
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt
|
||||
$array_global = $this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
//$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in product as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact)
|
||||
$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
// retrieve contact information for use in product as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
|
||||
$tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact);
|
||||
$tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
$object->fetch_optionals();
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
|
||||
@ -569,24 +569,25 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
//print exit;
|
||||
|
||||
|
||||
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in project as contact_xxx tags
|
||||
$array_project_contact = array();
|
||||
if ($usecontact)
|
||||
$array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
// retrieve contact information for use in project as contact_xxx tags
|
||||
$array_project_contact = array();
|
||||
if ($usecontact) $array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact);
|
||||
$tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
|
||||
@ -507,17 +507,18 @@ class doc_generic_task_odt extends ModelePDFTask
|
||||
//print exit;
|
||||
|
||||
|
||||
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($project,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($project,$outputlangs);
|
||||
$array_other=$this->get_substitutionarray_other($outputlangs);
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
|
||||
$tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
|
||||
@ -375,6 +375,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
//print html_entity_decode($odfHandler->__toString());
|
||||
//print exit;
|
||||
|
||||
$object->fetch_optionals();
|
||||
|
||||
// Make substitutions into odt of freetext
|
||||
try {
|
||||
@ -384,23 +385,25 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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_other=$this->get_substitutionarray_other($outputlangs);
|
||||
// retrieve contact information for use in proposal as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact)
|
||||
$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
// retrieve contact information for use in proposal as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
if ($usecontact) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
|
||||
$tmparray = array_merge($substitutionarray,$array_object_from_properties,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
$object->fetch_optionals();
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
|
||||
@ -381,18 +381,21 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
{
|
||||
}
|
||||
|
||||
// Make substitutions into odt
|
||||
// Define substitution array
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||
$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_other=$this->get_substitutionarray_other($outputlangs);
|
||||
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
|
||||
$tmparray = array_merge($substitutionarray,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user