PageRenderTime 71ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 1ms

/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php

https://bitbucket.org/speedealing/speedealing
PHP | 615 lines | 404 code | 90 blank | 121 comment | 42 complexity | bd14b24b467f50a26e43fe24a31b584f MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. * or see http://www.gnu.org/
  19. */
  20. /**
  21. * \file htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
  22. * \ingroup expedition
  23. * \brief Fichier de la classe permettant de generer les bordereaux envoi au modele Merou
  24. */
  25. require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
  26. require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
  29. /**
  30. * Classe permettant de generer les borderaux envoi au modele Merou
  31. */
  32. class pdf_expedition_merou extends ModelePdfExpedition
  33. {
  34. var $emetteur; // Objet societe qui emet
  35. /**
  36. * Constructor
  37. *
  38. * @param DoliDB $db Database handler
  39. */
  40. function __construct($db=0)
  41. {
  42. global $conf,$langs,$mysoc;
  43. $this->db = $db;
  44. $this->name = "merou";
  45. $this->description = $langs->trans("DocumentModelMerou");
  46. $this->type = 'pdf';
  47. $formatarray=pdf_getFormat();
  48. $this->page_largeur = $formatarray['width'];
  49. $this->page_hauteur = round($formatarray['height']/2);
  50. $this->format = array($this->page_largeur,$this->page_hauteur);
  51. $this->marge_gauche=10;
  52. $this->marge_droite=10;
  53. $this->marge_haute=10;
  54. $this->marge_basse=10;
  55. $this->option_logo = 1;
  56. // Recupere emmetteur
  57. $this->emetteur=$mysoc;
  58. if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // By default if not defined
  59. }
  60. /**
  61. * Function to build pdf onto disk
  62. *
  63. * @param Object &$object Object expedition to generate (or id if old method)
  64. * @param Translate $outputlangs Lang output object
  65. * @param string $srctemplatepath Full path of source filename for generator using a template file
  66. * @param int $hidedetails Do not show line details
  67. * @param int $hidedesc Do not show desc
  68. * @param int $hideref Do not show ref
  69. * @return int 1=OK, 0=KO
  70. */
  71. function write_file(&$object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
  72. {
  73. global $user,$conf,$langs,$mysoc;
  74. $default_font_size = pdf_getPDFFontSize($outputlangs);
  75. $object->fetch_thirdparty();
  76. if (! is_object($outputlangs)) $outputlangs=$langs;
  77. // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
  78. if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
  79. $outputlangs->load("main");
  80. $outputlangs->load("dict");
  81. $outputlangs->load("companies");
  82. $outputlangs->load("bills");
  83. $outputlangs->load("products");
  84. $outputlangs->load("propal");
  85. $outputlangs->load("deliveries");
  86. $outputlangs->load("sendings");
  87. if ($conf->expedition->dir_output)
  88. {
  89. $object->fetch_thirdparty();
  90. $origin = $object->origin;
  91. //Creation de l expediteur
  92. $this->expediteur = $mysoc;
  93. //Creation du destinataire
  94. $idcontact = $object->$origin->getIdContact('external','SHIPPING');
  95. $this->destinataire = new Contact($this->db);
  96. if (! empty($idcontact[0])) $this->destinataire->fetch($idcontact[0]);
  97. //Creation du livreur
  98. $idcontact = $object->$origin->getIdContact('internal','LIVREUR');
  99. $this->livreur = new User($this->db);
  100. if (! empty($idcontact[0])) $this->livreur->fetch($idcontact[0]);
  101. // Definition de $dir et $file
  102. if ($object->specimen)
  103. {
  104. $dir = $conf->expedition->dir_output."/sending";
  105. $file = $dir . "/SPECIMEN.pdf";
  106. }
  107. else
  108. {
  109. $expref = dol_sanitizeFileName($object->ref);
  110. $dir = $conf->expedition->dir_output . "/sending/" . $expref;
  111. $file = $dir . "/" . $expref . ".pdf";
  112. }
  113. if (! file_exists($dir))
  114. {
  115. if (dol_mkdir($dir) < 0)
  116. {
  117. $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
  118. return 0;
  119. }
  120. }
  121. if (file_exists($dir))
  122. {
  123. $nblignes = count($object->lines);
  124. $pdf=pdf_getInstance($this->format,'mm','l');
  125. $heightforinfotot = 0; // Height reserved to output the info and total part
  126. $heightforfooter = 28; // Height reserved to output the footer (value include bottom margin)
  127. $pdf->SetAutoPageBreak(1,0);
  128. if (class_exists('TCPDF'))
  129. {
  130. $pdf->setPrintHeader(false);
  131. $pdf->setPrintFooter(false);
  132. }
  133. $pdf->SetFont(pdf_getPDFFont($outputlangs));
  134. // Set path to the background PDF File
  135. if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
  136. {
  137. $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
  138. $tplidx = $pdf->importPage(1);
  139. }
  140. $pdf->Open();
  141. $pagenb=0;
  142. $pdf->SetDrawColor(128,128,128);
  143. $pdf->AliasNbPages();
  144. $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
  145. $pdf->SetSubject($outputlangs->transnoentities("Sending"));
  146. $pdf->SetCreator("Speedealing ".DOL_VERSION);
  147. $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
  148. $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
  149. if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
  150. $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
  151. // New page
  152. $pdf->AddPage();
  153. $pagenb++;
  154. $this->_pagehead($pdf, $object, 1, $outputlangs);
  155. $pdf->SetFont('','', $default_font_size - 3);
  156. $pdf->MultiCell(0, 3, ''); // Set interline to 3
  157. $pdf->SetTextColor(0,0,0);
  158. $tab_top = 52;
  159. $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
  160. $tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
  161. $tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;
  162. $pdf->SetFillColor(240,240,240);
  163. $pdf->SetTextColor(0,0,0);
  164. $pdf->SetXY(10, $tab_top + 5);
  165. $iniY = $tab_top + 7;
  166. $curY = $tab_top + 7;
  167. $nexY = $tab_top + 7;
  168. $num=count($object->lines);
  169. // Loop on each lines
  170. for ($i = 0; $i < $num; $i++)
  171. {
  172. $curY = $nexY;
  173. $pdf->SetFont('','', $default_font_size - 3);
  174. $pdf->SetTextColor(0,0,0);
  175. $pdf->setTopMargin($tab_top_newpage);
  176. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
  177. $pageposbefore=$pdf->getPage();
  178. // Description de la ligne produit
  179. $libelleproduitservice = pdf_writelinedesc($pdf,$object,$i,$outputlangs,90,3,50,$curY,0,1);
  180. $nexY = $pdf->GetY();
  181. $pageposafter=$pdf->getPage();
  182. $pdf->setPage($pageposbefore);
  183. $pdf->setTopMargin($this->marge_haute);
  184. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
  185. // We suppose that a too long description is moved completely on next page
  186. if ($pageposafter > $pageposbefore) {
  187. $pdf->setPage($pageposafter); $curY = $tab_top_newpage;
  188. }
  189. $pdf->SetFont('','', $default_font_size - 3);
  190. //Creation des cases a cocher
  191. $pdf->Rect(10+3, $curY, 3, 3);
  192. $pdf->Rect(20+3, $curY, 3, 3);
  193. //Insertion de la reference du produit
  194. $pdf->SetXY(30, $curY);
  195. $pdf->SetFont('','B', $default_font_size - 3);
  196. $pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0);
  197. $pdf->SetXY(140, $curY);
  198. $pdf->MultiCell(30, 3, $object->lines[$i]->qty_asked, 0, 'C', 0);
  199. $pdf->SetXY(170, $curY);
  200. $pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
  201. $nexY+=2; // Passe espace entre les lignes
  202. // Detect if some page were added automatically and output _tableau for past pages
  203. while ($pagenb < $pageposafter)
  204. {
  205. $pdf->setPage($pagenb);
  206. if ($pagenb == 1)
  207. {
  208. $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
  209. }
  210. else
  211. {
  212. $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
  213. }
  214. $this->_pagefoot($pdf,$object,$outputlangs);
  215. $pagenb++;
  216. $pdf->setPage($pagenb);
  217. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
  218. }
  219. if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
  220. {
  221. if ($pagenb == 1)
  222. {
  223. $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
  224. }
  225. else
  226. {
  227. $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
  228. }
  229. $this->_pagefoot($pdf,$object,$outputlangs);
  230. // New page
  231. $pdf->AddPage();
  232. $pagenb++;
  233. }
  234. }
  235. // Show square
  236. if ($pagenb == 1)
  237. {
  238. $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0);
  239. $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
  240. }
  241. else
  242. {
  243. $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, 1, 0);
  244. $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
  245. }
  246. // Pied de page
  247. $this->_pagefoot($pdf, $object, $outputlangs);
  248. $pdf->AliasNbPages();
  249. $pdf->Close();
  250. $pdf->Output($file,'F');
  251. if (! empty($conf->global->MAIN_UMASK))
  252. @chmod($file, octdec($conf->global->MAIN_UMASK));
  253. return 1;
  254. }
  255. else
  256. {
  257. $this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
  258. return 0;
  259. }
  260. }
  261. else
  262. {
  263. $this->error=$outputlangs->transnoentities("ErrorConstantNotDefined","EXP_OUTPUTDIR");
  264. return 0;
  265. }
  266. $this->error=$outputlangs->transnoentities("ErrorUnknown");
  267. return 0; // Erreur par defaut
  268. }
  269. /**
  270. * Show table for lines
  271. *
  272. * @param PDF &$pdf Object PDF
  273. * @param string $tab_top Top position of table
  274. * @param string $tab_height Height of table (rectangle)
  275. * @param int $nexY Y
  276. * @param Translate $outputlangs Langs object
  277. * @param int $hidetop Hide top bar of array
  278. * @param int $hidebottom Hide bottom bar of array
  279. * @return void
  280. */
  281. function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
  282. {
  283. global $langs;
  284. $default_font_size = pdf_getPDFFontSize($outputlangs);
  285. $langs->load("main");
  286. $langs->load("bills");
  287. if (empty($hidetop))
  288. {
  289. $pdf->SetFont('','B', $default_font_size - 2);
  290. $pdf->SetXY(10,$tab_top);
  291. $pdf->MultiCell(10,5,"LS",0,'C',1);
  292. $pdf->line(20, $tab_top, 20, $tab_top + $tab_height);
  293. $pdf->SetXY(20,$tab_top);
  294. $pdf->MultiCell(10,5,"LR",0,'C',1);
  295. $pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
  296. $pdf->SetXY(30,$tab_top);
  297. $pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1);
  298. $pdf->SetXY(50,$tab_top);
  299. $pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
  300. $pdf->SetXY(140,$tab_top);
  301. $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1);
  302. $pdf->SetXY(170,$tab_top);
  303. $pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1);
  304. }
  305. $pdf->Rect(10, $tab_top, 190, $tab_height);
  306. }
  307. /**
  308. * Show footer of page. Need this->emetteur object
  309. *
  310. * @param PDF &$pdf PDF
  311. * @param Object $object Object to show
  312. * @param Translate $outputlangs Object lang for output
  313. * @return void
  314. */
  315. function _pagefoot(&$pdf, $object, $outputlangs)
  316. {
  317. $default_font_size = pdf_getPDFFontSize($outputlangs);
  318. $pdf->SetFont('','', $default_font_size - 2);
  319. $pdf->SetY(-23);
  320. $pdf->MultiCell(100, 3, $outputlangs->transnoentities("GoodStatusDeclaration"), 0, 'L');
  321. $pdf->SetY(-13);
  322. $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ToAndDate"), 0, 'C');
  323. $pdf->SetXY(120,-23);
  324. $pdf->MultiCell(100, 3, $outputlangs->transnoentities("NameAndSignature"), 0, 'C');
  325. // Show page nb only on iso languages (so default Helvetica font)
  326. //if (pdf_getPDFFont($outputlangs) == 'Helvetica')
  327. //{
  328. // $pdf->SetXY(-10,-10);
  329. // $pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
  330. //}
  331. }
  332. /**
  333. * Show top header of page.
  334. *
  335. * @param PDF &$pdf Object PDF
  336. * @param Object $object Object to show
  337. * @param int $showaddress 0=no, 1=yes
  338. * @param Translate $outputlangs Object lang for output
  339. * @return void
  340. */
  341. function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
  342. {
  343. global $conf, $langs;
  344. $default_font_size = pdf_getPDFFontSize($outputlangs);
  345. pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
  346. //Affiche le filigrane brouillon - Print Draft Watermark
  347. if($object->statut==0 && (! empty($conf->global->SENDING_DRAFT_WATERMARK)) )
  348. {
  349. pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->SENDING_DRAFT_WATERMARK);
  350. }
  351. $posy=$this->marge_haute;
  352. $posx=$this->page_largeur-$this->marge_droite-100;
  353. $Xoff = 90;
  354. $Yoff = 0;
  355. $tab4_top = 60;
  356. $tab4_hl = 6;
  357. $tab4_sl = 4;
  358. $line = 2;
  359. //*********************LOGO****************************
  360. $pdf->SetXY(11,7);
  361. $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
  362. if ($this->emetteur->logo)
  363. {
  364. if (is_readable($logo))
  365. {
  366. $height=pdf_getHeightForLogo($logo);
  367. $pdf->Image($logo,10, 5, 0, $height); // width=0 (auto)
  368. }
  369. else
  370. {
  371. $pdf->SetTextColor(200,0,0);
  372. $pdf->SetFont('','B', $default_font_size - 2);
  373. $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
  374. $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
  375. }
  376. }
  377. else
  378. {
  379. $text=$this->emetteur->name;
  380. $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($text), 0, 'L');
  381. }
  382. //*********************Entete****************************
  383. //Nom du Document
  384. $pdf->SetXY($Xoff,7);
  385. $pdf->SetFont('','B', $default_font_size + 2);
  386. $pdf->SetTextColor(0,0,0);
  387. $pdf->MultiCell(0, 3, $outputlangs->transnoentities("SendingSheet"), '', 'L'); // Bordereau expedition
  388. //Num Expedition
  389. $Yoff = $Yoff+7;
  390. $Xoff = 142;
  391. //$pdf->Rect($Xoff, $Yoff, 85, 8);
  392. $pdf->SetXY($Xoff,$Yoff);
  393. $pdf->SetFont('','', $default_font_size - 2);
  394. $pdf->SetTextColor(0,0,0);
  395. $pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '', 'R');
  396. //$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
  397. // Add list of linked elements
  398. // TODO possibility to use with other elements (business module,...)
  399. //$object->load_object_linked();
  400. $origin = $object->origin;
  401. $origin_id = $object->origin_id;
  402. // TODO move to external function
  403. if ($conf->$origin->enabled)
  404. {
  405. $outputlangs->load('orders');
  406. $classname = ucfirst($origin);
  407. $linkedobject = new $classname($this->db);
  408. $result=$linkedobject->fetch($origin_id);
  409. if ($result >= 0)
  410. {
  411. $Yoff = $Yoff+4;
  412. $pdf->SetXY($Xoff,$Yoff);
  413. $pdf->SetFont('','', $default_font_size - 2);
  414. $text=$linkedobject->ref;
  415. if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
  416. $pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
  417. }
  418. }
  419. //$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
  420. //Definition Emplacement du bloc Societe
  421. $Xoff = 110;
  422. $blSocX=90;
  423. $blSocY=24;
  424. $blSocW=50;
  425. $blSocX2=$blSocW+$blSocX;
  426. // Sender name
  427. $pdf->SetTextColor(0,0,0);
  428. $pdf->SetFont('','B', $default_font_size - 3);
  429. $pdf->SetXY($blSocX,$blSocY+1);
  430. $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
  431. $pdf->SetTextColor(0,0,0);
  432. // Sender properties
  433. $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
  434. $pdf->SetFont('','', $default_font_size - 3);
  435. $pdf->SetXY($blSocX,$blSocY+4);
  436. $pdf->MultiCell(80, 2, $carac_emetteur, 0, 'L');
  437. if ($object->client->code_client)
  438. {
  439. $Yoff+=7;
  440. $posy=$Yoff;
  441. $pdf->SetXY(100,$posy);
  442. $pdf->SetTextColor(0,0,60);
  443. $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
  444. }
  445. //Date Expedition
  446. $Yoff = $Yoff+7;
  447. $pdf->SetXY($blSocX-80,$blSocY+20);
  448. $pdf->SetFont('','B', $default_font_size - 2);
  449. $pdf->SetTextColor(0,0,0);
  450. $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L');
  451. // Deliverer
  452. $pdf->SetXY($blSocX-80,$blSocY+23);
  453. $pdf->SetFont('','', $default_font_size - 2);
  454. $pdf->SetTextColor(0,0,0);
  455. if (! empty($object->tracking_number))
  456. {
  457. $object->GetUrlTrackingStatus($object->tracking_number);
  458. if (! empty($object->tracking_url))
  459. {
  460. if ($object->expedition_method_id > 0)
  461. {
  462. // Get code using getLabelFromKey
  463. $code=$outputlangs->getLabelFromKey($this->db,$object->expedition_method_id,'c_shipment_mode','rowid','code');
  464. $label=$outputlangs->trans("SendingMethod".strtoupper($code))." :";
  465. }
  466. else
  467. {
  468. $label=$outputlangs->transnoentities("Deliverer");
  469. }
  470. $pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L');
  471. }
  472. }
  473. else
  474. {
  475. $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Deliverer")." ".$outputlangs->convToOutputCharset($this->livreur->getFullName($outputlangs)), '', 'L');
  476. }
  477. /**********************************/
  478. //Emplacement Informations Expediteur (My Company)
  479. /**********************************/
  480. $Yoff = $blSocY;
  481. $blExpX=$Xoff-20;
  482. $blW=52;
  483. $Ydef = $Yoff;
  484. $pdf->Rect($blExpX, $Yoff, $blW, 26);
  485. $object->fetch_thirdparty();
  486. // If SHIPPING contact defined on order, we use it
  487. $usecontact=false;
  488. $arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');
  489. if (count($arrayidcontact) > 0)
  490. {
  491. $usecontact=true;
  492. $result=$object->fetch_contact($arrayidcontact[0]);
  493. }
  494. // Recipient name
  495. if (! empty($usecontact))
  496. {
  497. // On peut utiliser le nom de la societe du contact
  498. if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
  499. else $socname = $object->client->nom;
  500. $carac_client_name=$outputlangs->convToOutputCharset($socname);
  501. }
  502. else
  503. {
  504. $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
  505. }
  506. $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
  507. $blDestX=$blExpX+55;
  508. $blW=50;
  509. $Yoff = $Ydef +1;
  510. // Show recipient frame
  511. $pdf->SetFont('','B', $default_font_size - 3);
  512. $pdf->SetXY($blDestX,$Yoff-4);
  513. $pdf->MultiCell($blW,3, $outputlangs->transnoentities("Recipient"), 0, 'L');
  514. $pdf->Rect($blDestX, $Yoff-1, $blW, 26);
  515. // Show recipient name
  516. $pdf->SetFont('','B', $default_font_size - 3);
  517. $pdf->SetXY($blDestX,$Yoff);
  518. $pdf->MultiCell($blW,3, $carac_client_name, 0, 'L');
  519. // Show recipient information
  520. $pdf->SetFont('','', $default_font_size - 3);
  521. $pdf->SetXY($blDestX,$Yoff+(dol_nboflines_bis($carac_client_name,50)*4));
  522. $pdf->MultiCell($blW,2, $carac_client, 0, 'L');
  523. }
  524. }
  525. ?>