FIX Error generating ODT when option to use contact on doc on

This commit is contained in:
Laurent Destailleur 2018-10-31 15:31:22 +01:00
parent b0ef8680ff
commit ca726e6c94
8 changed files with 53 additions and 60 deletions

View File

@ -360,10 +360,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
$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 object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $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);
complete_substitutions_array($tmparray, $outputlangs, $object);

View File

@ -309,9 +309,9 @@ class doc_generic_contract_odt extends ModelePDFContract
$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
// 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');
if ($usecontact && is_object($contactobject)) $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);
complete_substitutions_array($substitutionarray, $outputlangs, $object);

View File

@ -368,10 +368,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$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 object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $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);
complete_substitutions_array($tmparray, $outputlangs, $object);

View File

@ -95,7 +95,7 @@ class doc_generic_product_odt extends ModelePDFProduct
function info($langs)
{
global $conf,$langs;
$langs->load("companies");
$langs->load("errors");
@ -369,7 +369,7 @@ class doc_generic_product_odt extends ModelePDFProduct
catch(OdfException $e)
{
}
// Make substitutions into odt
$array_global = $this->get_substitutionarray_each_var_object($object, $outputlangs);
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
@ -377,10 +377,9 @@ class doc_generic_product_odt extends ModelePDFProduct
$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 order as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $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);
complete_substitutions_array($tmparray, $outputlangs, $object);

View File

@ -136,7 +136,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$object->fetch_optionals($object->id,$extralabels);
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs);
return $resarray;
}
@ -168,16 +168,16 @@ class doc_generic_project_odt extends ModelePDFProjects
'task_note_private'=>$task->note_private,
'task_note_public'=>$task->note_public
);
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($task->table_element,true);
$task->fetch_optionals($task->id,$extralabels);
$resarray = $this->fill_substitutionarray_with_extrafields($task,$resarray,$extrafields,'task',$outputlangs);
return $resarray;
}
/**
@ -206,13 +206,13 @@ class doc_generic_project_odt extends ModelePDFProjects
if ($contact['source']=='external') {
$ret[$pc.'isInternal'] = ''; // not internal
$ct = new Contact($this->db);
$ct->fetch($contact['id']);
$ret[$pc.'phone_pro'] = $ct->phone_pro;
$ret[$pc.'phone_perso'] = $ct->phone_perso;
$ret[$pc.'phone_mobile'] = $ct->phone_mobile;
// fetch external user extrafields
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
@ -225,7 +225,7 @@ class doc_generic_project_odt extends ModelePDFProjects
}
} elseif ($contact['source']=='internal') {
$ret[$pc.'isInternal'] = '1'; // this is an internal user
$ct = new User($this->db);
$ct->fetch($contact['id']);
$ret[$pc.'phone_pro'] = $ct->office_phone;
@ -588,10 +588,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$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 order as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
@ -932,109 +931,109 @@ class doc_generic_project_odt extends ModelePDFProjects
'title' => "ListProposalsAssociatedProject",
'class' => 'Propal',
'table' => 'propal',
'test' => $conf->propal->enabled && $user->rights->propale->lire
'test' => $conf->propal->enabled && $user->rights->propale->lire
),
'order' => array(
'title' => "ListOrdersAssociatedProject",
'class' => 'Commande',
'table' => 'commande',
'test' => $conf->commande->enabled && $user->rights->commande->lire
'test' => $conf->commande->enabled && $user->rights->commande->lire
),
'invoice' => array(
'title' => "ListInvoicesAssociatedProject",
'class' => 'Facture',
'table' => 'facture',
'test' => $conf->facture->enabled && $user->rights->facture->lire
'test' => $conf->facture->enabled && $user->rights->facture->lire
),
'invoice_predefined' => array(
'title' => "ListPredefinedInvoicesAssociatedProject",
'class' => 'FactureRec',
'table' => 'facture_rec',
'test' => $conf->facture->enabled && $user->rights->facture->lire
'test' => $conf->facture->enabled && $user->rights->facture->lire
),
'proposal_supplier' => array(
'title' => "ListSupplierProposalsAssociatedProject",
'class' => 'SupplierProposal',
'table' => 'supplier_proposal',
'test' => $conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire
'test' => $conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire
),
'order_supplier' => array(
'title' => "ListSupplierOrdersAssociatedProject",
'table' => 'commande_fournisseur',
'class' => 'CommandeFournisseur',
'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire
'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire
),
'invoice_supplier' => array(
'title' => "ListSupplierInvoicesAssociatedProject",
'table' => 'facture_fourn',
'class' => 'FactureFournisseur',
'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire
'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire
),
'contract' => array(
'title' => "ListContractAssociatedProject",
'class' => 'Contrat',
'table' => 'contrat',
'test' => $conf->contrat->enabled && $user->rights->contrat->lire
'test' => $conf->contrat->enabled && $user->rights->contrat->lire
),
'intervention' => array(
'title' => "ListFichinterAssociatedProject",
'class' => 'Fichinter',
'table' => 'fichinter',
'disableamount' => 1,
'test' => $conf->ficheinter->enabled && $user->rights->ficheinter->lire
'test' => $conf->ficheinter->enabled && $user->rights->ficheinter->lire
),
'shipping' => array(
'title' => "ListShippingAssociatedProject",
'class' => 'Expedition',
'table' => 'expedition',
'disableamount' => 1,
'test' => $conf->expedition->enabled && $user->rights->expedition->lire
'test' => $conf->expedition->enabled && $user->rights->expedition->lire
),
'trip' => array(
'title' => "ListTripAssociatedProject",
'class' => 'Deplacement',
'table' => 'deplacement',
'disableamount' => 1,
'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire
'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire
),
'expensereport' => array(
'title' => "ListExpenseReportsAssociatedProject",
'class' => 'ExpenseReportLine',
'table' => 'expensereport_det',
'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire
'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire
),
'donation' => array(
'title' => "ListDonationsAssociatedProject",
'class' => 'Don',
'table' => 'don',
'test' => $conf->don->enabled && $user->rights->don->lire
'test' => $conf->don->enabled && $user->rights->don->lire
),
'loan' => array(
'title' => "ListLoanAssociatedProject",
'class' => 'Loan',
'table' => 'loan',
'test' => $conf->loan->enabled && $user->rights->loan->read
'test' => $conf->loan->enabled && $user->rights->loan->read
),
'chargesociales' => array(
'title' => "ListSocialContributionAssociatedProject",
'class' => 'ChargeSociales',
'table' => 'chargesociales',
'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $id,
'test' => $conf->tax->enabled && $user->rights->tax->charges->lire
'test' => $conf->tax->enabled && $user->rights->tax->charges->lire
),
'stock_mouvement' => array(
'title' => "ListMouvementStockProject",
'class' => 'MouvementStock',
'table' => 'stock_mouvement',
'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))
'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))
),
'agenda' => array(
'title' => "ListActionsAssociatedProject",
'class' => 'ActionComm',
'table' => 'actioncomm',
'disableamount' => 1,
'test' => $conf->agenda->enabled && $user->rights->agenda->allactions->lire
)
'test' => $conf->agenda->enabled && $user->rights->agenda->allactions->lire
)
);
//Insert reference
@ -1171,7 +1170,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
}
else

View File

@ -390,10 +390,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$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 object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $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);
complete_substitutions_array($tmparray, $outputlangs, $object);

View File

@ -338,10 +338,9 @@ class doc_generic_user_odt extends ModelePDFUser
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
$array_other=$this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in user 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 object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);
@ -409,7 +408,7 @@ class doc_generic_user_odt extends ModelePDFUser
$odfHandler=null; // Destroy object
$this->result = array('fullpath'=>$file);
return 1; // Success
}
else

View File

@ -376,10 +376,9 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
$array_objet=$this->get_substitutionarray_each_var_object($object,$outputlangs);
$array_other=$this->get_substitutionarray_other($outputlangs);
// retrieve contact information for use in user 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 object as contact_xxx tags
$array_thirdparty_contact = array();
if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
$tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
complete_substitutions_array($tmparray, $outputlangs, $object);