forked from Wavyzz/dolibarr
Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW_stockstransfers
This commit is contained in:
@@ -295,12 +295,14 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -53,7 +53,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
public $phpmin = array(5, 6);
|
||||
|
||||
/**
|
||||
* @var string Dolibarr version of the loaded document
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr';
|
||||
|
||||
@@ -96,7 +97,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$this->option_freetext = 1; // Support add of a personalised text
|
||||
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
|
||||
|
||||
// Recupere emetteur
|
||||
// Get source company
|
||||
$this->emetteur = $mysoc;
|
||||
if (!$this->emetteur->country_code) {
|
||||
$this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
|
||||
@@ -234,6 +235,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$sav_charset_output = $outputlangs->charset_output;
|
||||
$outputlangs->charset_output = 'UTF-8';
|
||||
|
||||
// Load translation files required by the page
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
|
||||
|
||||
if ($conf->commande->dir_output) {
|
||||
@@ -271,7 +273,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
|
||||
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
|
||||
$newfiletmp = $objectref.'_'.$newfiletmp;
|
||||
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
|
||||
|
||||
// Get extension (ods or odt)
|
||||
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
|
||||
if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
|
||||
@@ -307,11 +309,14 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
@@ -379,6 +384,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$array_other = $this->get_substitutionarray_other($outputlangs);
|
||||
// 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');
|
||||
}
|
||||
@@ -455,7 +461,6 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
||||
@@ -1449,7 +1449,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -1634,7 +1634,7 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
//Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -295,11 +295,14 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -720,7 +720,7 @@ class pdf_strato extends ModelePDFContract
|
||||
$this->recipient = $object->thirdparty;
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -860,7 +860,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -859,7 +859,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -307,11 +307,14 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a SHIPPING contact and we dont use as recipient we store the contact object for later use
|
||||
// if we have a SHIPPING contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
/**
|
||||
* Class to build sending documents with model espadon
|
||||
@@ -651,6 +651,11 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
if ($this->getColumnStatus('unit_order')) {
|
||||
$this->printStdColumnContent($pdf, $curY, 'unit_order', measuringUnitString($object->lines[$i]->fk_unit));
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
}
|
||||
|
||||
if ($this->getColumnStatus('qty_shipped')) {
|
||||
$this->printStdColumnContent($pdf, $curY, 'qty_shipped', $object->lines[$i]->qty_shipped);
|
||||
$nexY = max($pdf->GetY(), $nexY);
|
||||
@@ -1121,7 +1126,7 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
@@ -1312,6 +1317,20 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
),
|
||||
);
|
||||
|
||||
$rank = $rank + 10;
|
||||
$this->cols['unit_order'] = array(
|
||||
'rank' => $rank,
|
||||
'width' => 15, // in mm
|
||||
'status' => empty($conf->global->PRODUCT_USE_UNITS) ? 0 : 1,
|
||||
'title' => array(
|
||||
'textkey' => 'Unit'
|
||||
),
|
||||
'border-left' => true, // add left line separator
|
||||
'content' => array(
|
||||
'align' => 'C',
|
||||
),
|
||||
);
|
||||
|
||||
$rank = $rank + 10;
|
||||
$this->cols['qty_shipped'] = array(
|
||||
'rank' => $rank,
|
||||
|
||||
@@ -676,7 +676,7 @@ class pdf_merou extends ModelePdfExpedition
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -1071,7 +1071,7 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -308,11 +308,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a BILLING contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1927,7 +1927,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -2143,7 +2143,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -674,7 +674,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -295,11 +295,14 @@ class doc_generic_member_odt extends ModelePDFMember
|
||||
|
||||
// Recipient name
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -302,11 +302,14 @@ class doc_generic_mo_odt extends ModelePDFMo
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -118,15 +118,10 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
$form = new Form($this->db);
|
||||
|
||||
$texte = $this->description.".<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
$texte .= '<input type="hidden" name="param1" value="PRODUCT_ADDON_PDF_ODT_PATH">';
|
||||
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) {
|
||||
$texte .= '<input type="hidden" name="param2" value="PRODUCT_ADDON_PDF_ODT_DEFAULT">';
|
||||
$texte .= '<input type="hidden" name="param3" value="PRODUCT_ADDON_PDF_ODT_TOBILL">';
|
||||
$texte .= '<input type="hidden" name="param4" value="PRODUCT_ADDON_PDF_ODT_CLOSED">';
|
||||
}
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
// List of directories area
|
||||
@@ -165,35 +160,25 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
$texte .= '<br></div></div>';
|
||||
|
||||
// Scan directories
|
||||
if (count($listofdir)) {
|
||||
$nbofiles = count($listoffiles);
|
||||
if (!empty($conf->global->PRODUCT_ADDON_PDF_ODT_PATH)) {
|
||||
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
||||
|
||||
/*if ($conf->global->MAIN_PRODUCT_CHOOSE_ODT_DOCUMENT > 0)
|
||||
{
|
||||
// Model for creation
|
||||
$liste=ModelePDFProduct::liste_modeles($this->db);
|
||||
$texte.= '<table width="50%;">';
|
||||
$texte.= '<tr>';
|
||||
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
|
||||
$texte.= '<td colspan="">';
|
||||
$texte.= $form->selectarray('value2',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_DEFAULT);
|
||||
$texte.= "</td></tr>";
|
||||
|
||||
$texte.= '<tr>';
|
||||
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
|
||||
$texte.= '<td colspan="">';
|
||||
$texte.= $form->selectarray('value3',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_TOBILL);
|
||||
$texte.= "</td></tr>";
|
||||
$texte.= '<tr>';
|
||||
|
||||
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
|
||||
$texte.= '<td colspan="">';
|
||||
$texte.= $form->selectarray('value4',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_CLOSED);
|
||||
$texte.= "</td></tr>";
|
||||
$texte.= '</table>';
|
||||
}*/
|
||||
}
|
||||
|
||||
if ($nbofiles) {
|
||||
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
|
||||
// Show list of found files
|
||||
foreach ($listoffiles as $file) {
|
||||
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=products/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>';
|
||||
}
|
||||
$texte .= '</div>';
|
||||
}
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="PRODUCT_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
|
||||
$texte .= '</td>';
|
||||
|
||||
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
|
||||
@@ -319,11 +304,14 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
@@ -344,7 +332,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
|
||||
// Line of free text
|
||||
$newfreetext = '';
|
||||
$paramfreetext = 'product_FREE_TEXT';
|
||||
$paramfreetext = 'PRODUCT_FREE_TEXT';
|
||||
if (!empty($conf->global->$paramfreetext)) {
|
||||
$newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
|
||||
}
|
||||
@@ -372,7 +360,6 @@ 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 {
|
||||
@@ -399,7 +386,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$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) {
|
||||
@@ -480,6 +467,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
}
|
||||
}
|
||||
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
|
||||
@@ -335,11 +335,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1616,7 +1616,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -1731,7 +1731,7 @@ class pdf_cyan extends ModelePDFPropales
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -62,8 +62,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
{
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("companies");
|
||||
$langs->loadLangs(array("main", "companies"));
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "ODT templates";
|
||||
@@ -173,6 +172,11 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
}
|
||||
$texte .= '</div>';
|
||||
}
|
||||
// Add input to upload a new template file.
|
||||
$texte .= '<div>'.$langs->trans("UploadNewTemplate").' <input type="file" name="uploadfile">';
|
||||
$texte .= '<input type="hidden" value="RECEPTION_ADDON_PDF_ODT_PATH" name="keyforuploaddir">';
|
||||
$texte .= '<input type="submit" class="button small" value="'.dol_escape_htmltag($langs->trans("Upload")).'" name="upload">';
|
||||
$texte .= '</div>';
|
||||
|
||||
$texte .= '</td>';
|
||||
|
||||
@@ -223,10 +227,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
$sav_charset_output = $outputlangs->charset_output;
|
||||
$outputlangs->charset_output = 'UTF-8';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
|
||||
|
||||
if ($conf->reception->dir_output."/reception") {
|
||||
// If $object is id instead of object
|
||||
@@ -288,21 +289,25 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
return -1;
|
||||
}
|
||||
|
||||
// If BILLING contact defined on invoice, we use it
|
||||
// If CUSTOMER contact defined on reception, we use it
|
||||
$usecontact = false;
|
||||
$arrayidcontact = $object->getIdContact('external', 'BILLING');
|
||||
$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
|
||||
if (count($arrayidcontact) > 0) {
|
||||
$usecontact = true;
|
||||
$result = $object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
@@ -318,6 +323,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
'__TOTAL_VAT__' => $object->total_tva
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
|
||||
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
@@ -343,6 +349,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
// After construction $odfHandler->contentXml contains content and
|
||||
@@ -359,67 +366,23 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
|
||||
// Make substitutions into odt of user info
|
||||
$tmparray = $this->get_substitutionarray_user($user, $outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach ($tmparray as $key => $value) {
|
||||
try {
|
||||
if (preg_match('/logo$/', $key)) { // Image
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) {
|
||||
$odfHandler->setImage($key, $value);
|
||||
} else {
|
||||
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
} else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
} catch (OdfException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_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_other = $this->get_substitutionarray_other($outputlangs);
|
||||
// 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');
|
||||
}
|
||||
// Make substitutions into odt of mysoc
|
||||
$tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
|
||||
//var_dump($tmparray); exit;
|
||||
foreach ($tmparray as $key => $value) {
|
||||
try {
|
||||
if (preg_match('/logo$/', $key)) { // Image
|
||||
//var_dump($value);exit;
|
||||
if (file_exists($value)) {
|
||||
$odfHandler->setImage($key, $value);
|
||||
} else {
|
||||
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
} else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
} catch (OdfException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of thirdparty
|
||||
$tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
|
||||
foreach ($tmparray as $key => $value) {
|
||||
try {
|
||||
if (preg_match('/logo$/', $key)) { // Image
|
||||
if (file_exists($value)) {
|
||||
$odfHandler->setImage($key, $value);
|
||||
} else {
|
||||
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||
}
|
||||
} else // Text
|
||||
{
|
||||
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||
}
|
||||
} catch (OdfException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
// Replace tags of object + external modules
|
||||
$tmparray = $this->get_substitutionarray_reception($object, $outputlangs);
|
||||
|
||||
$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
|
||||
$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
|
||||
@@ -441,25 +404,36 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
}
|
||||
// Replace tags of lines
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
foreach ($object->lines as $line) {
|
||||
$tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
|
||||
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach ($tmparray as $key => $val) {
|
||||
try {
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
} catch (OdfException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
} catch (SegmentException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
$foundtagforlines = 1;
|
||||
try {
|
||||
$listlines = $odfHandler->setSegment('lines');
|
||||
} catch (OdfException $e) {
|
||||
// We may arrive here if tags for lines not present into template
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
if ($foundtagforlines) {
|
||||
$linenumber = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$linenumber++;
|
||||
$tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
|
||||
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach ($tmparray as $key => $val) {
|
||||
try {
|
||||
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||
} catch (OdfException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
} catch (SegmentException $e) {
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
}
|
||||
$listlines->merge();
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
}
|
||||
$odfHandler->mergeSegment($listlines);
|
||||
} catch (OdfException $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($this->error, LOG_WARNING);
|
||||
@@ -486,6 +460,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
$odfHandler->exportAsAttachedPDF($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -493,6 +468,7 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
$odfHandler->saveToDisk($file);
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -505,6 +481,8 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
|
||||
$odfHandler = null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
return 1; // Success
|
||||
} else {
|
||||
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
|
||||
|
||||
@@ -972,7 +972,7 @@ class pdf_squille extends ModelePdfReception
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -308,11 +308,14 @@ class doc_generic_stock_odt extends ModelePDFStock
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1238,7 +1238,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $mysoc;
|
||||
|
||||
@@ -298,11 +298,14 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1407,7 +1407,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -1314,7 +1314,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
}
|
||||
|
||||
// Recipient name
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->thirdparty;
|
||||
|
||||
@@ -332,11 +332,14 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
// Recipient name
|
||||
$contactobject = null;
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1418,7 +1418,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
|
||||
// Recipient name
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($usecontact && ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socname = $object->contact;
|
||||
} else {
|
||||
$socname = $object->thirdparty;
|
||||
|
||||
@@ -293,11 +293,14 @@ class doc_generic_ticket_odt extends ModelePDFTicket
|
||||
|
||||
// Recipient name
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -325,7 +325,7 @@ class doc_generic_user_odt extends ModelePDFUser
|
||||
|
||||
// Recipient name
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$socobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
|
||||
@@ -315,11 +315,14 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
|
||||
|
||||
// Recipient name
|
||||
if (!empty($usecontact)) {
|
||||
if ($usecontact && ($object->contact->fk_soc != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)))) {
|
||||
$socobject = $object->contact;
|
||||
// We can use the company of contact instead of thirdparty company
|
||||
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
|
||||
$object->contact->fetch_thirdparty();
|
||||
$socobject = $object->contact->thirdparty;
|
||||
$contactobject = $object->contact;
|
||||
} else {
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
|
||||
// if we have a CUSTOMER contact and we dont use it as thirdparty recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user