mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -47,14 +47,21 @@ if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
|
||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage=array('adminihm','globaladmin');
|
||||
$hookmanager->initHooks($contextpage);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (GETPOST('cancel','alpha'))
|
||||
{
|
||||
$action='';
|
||||
|
||||
@@ -431,16 +431,16 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs,1));
|
||||
|
||||
if (!empty($targetcontact->address)) {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcontact));
|
||||
}else {
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
|
||||
}
|
||||
// Country
|
||||
if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) {
|
||||
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code))."\n";
|
||||
$stringaddress.= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code));
|
||||
}
|
||||
else if (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) {
|
||||
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
|
||||
$stringaddress.= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
|
||||
@@ -472,9 +472,9 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
}
|
||||
else
|
||||
{
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany))."\n";
|
||||
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($targetcompany));
|
||||
// Country
|
||||
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
|
||||
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code));
|
||||
|
||||
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
|
||||
{
|
||||
@@ -507,7 +507,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
// Intra VAT
|
||||
if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))
|
||||
{
|
||||
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
if ($targetcompany->tva_intra) $stringaddress.=($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
|
||||
}
|
||||
|
||||
// Professionnal Ids
|
||||
@@ -515,37 +515,37 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && ! empty($targetcompany->idprof2))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && ! empty($targetcompany->idprof3))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && ! empty($targetcompany->idprof4))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID5_IN_ADDRESS) && ! empty($targetcompany->idprof5))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId5",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
|
||||
}
|
||||
if (! empty($conf->global->MAIN_PROFID6_IN_ADDRESS) && ! empty($targetcompany->idprof6))
|
||||
{
|
||||
$tmp=$outputlangs->transcountrynoentities("ProfId6",$targetcompany->country_code);
|
||||
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
|
||||
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
|
||||
}
|
||||
|
||||
// Public note
|
||||
@@ -553,11 +553,11 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
|
||||
{
|
||||
if ($mode == 'source' && ! empty($sourcecompany->note_public))
|
||||
{
|
||||
$stringaddress.="\n".dol_string_nohtmltag($sourcecompany->note_public);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).dol_string_nohtmltag($sourcecompany->note_public);
|
||||
}
|
||||
if (($mode == 'target' || preg_match('/targetwithdetails/',$mode)) && ! empty($targetcompany->note_public))
|
||||
{
|
||||
$stringaddress.="\n".dol_string_nohtmltag($targetcompany->note_public);
|
||||
$stringaddress.=($stringaddress ? "\n" : '' ).dol_string_nohtmltag($targetcompany->note_public);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user