Browse Source

Fix position on merou
Fix preselected value on contact

Laurent Destailleur 5 years ago
parent
commit
37fce0d3ee

+ 1 - 0
htdocs/core/class/html.formcompany.class.php

@@ -730,6 +730,7 @@ class FormCompany extends Form
 		if (is_object($object) && method_exists($object, 'liste_type_contact'))
 		{
 			$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
+
 			print '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
 			if ($showempty) print '<option value="0"></option>';
 			foreach ($lesTypes as $key=>$value)

+ 3 - 3
htdocs/core/modules/expedition/doc/pdf_merou.modules.php

@@ -591,7 +591,7 @@ class pdf_merou extends ModelePdfExpedition
 		$pdf->SetXY($Xoff, $Yoff);
 		$pdf->SetFont('', '', $default_font_size - 2);
 		$pdf->SetTextColor(0, 0, 0);
-		$pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '', 'R');
+		$pdf->MultiCell($this->page_largeur - $this->marge_droite - $Xoff, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '', 'R');
 		//$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
 
 		$origin = $object->origin;
@@ -627,9 +627,9 @@ class pdf_merou extends ModelePdfExpedition
 		{
 			$Yoff += 3;
 			$posy = $Yoff;
-			$pdf->SetXY(100, $posy);
+			$pdf->SetXY($Xoff, $posy);
 			$pdf->SetTextColor(0, 0, 0);
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
+			$pdf->MultiCell($this->page_largeur - $this->marge_droite - $Xoff, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
 		}
 
 		// Date delivery

+ 6 - 1
htdocs/core/tpl/contacts.tpl.php

@@ -19,6 +19,8 @@
  * This template needs:
  * $object
  * $withproject (if we are on task contact)
+ *
+ * $preselectedtypeofcontact may be defined or not
  */
 
 // Protection to avoid direct call of template
@@ -28,6 +30,9 @@ if (empty($object) || !is_object($object))
 	exit;
 }
 
+if (empty($preselectedtypeofcontact)) {
+	$preselectedtypeofcontact = 0;
+}
 
 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@@ -142,7 +147,7 @@ if ($permission) {
 			<?php
 			$tmpobject=$object;
 			if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
-			$formcompany->selectTypeContact($tmpobject, '', 'type', 'external', 'position', 0, 'minwidth100imp'); ?>
+			$formcompany->selectTypeContact($tmpobject, $preselectedtypeofcontact, 'type', 'external', 'position', 0, 'minwidth100imp'); ?>
 		</div>
 		<div class="tagtd noborderbottom">&nbsp;</div>
 		<div class="tagtd center noborderbottom">

+ 1 - 0
htdocs/expedition/contact.php

@@ -260,6 +260,7 @@ if ($id > 0 || !empty($ref))
 
 	// Contacts lines (modules that overwrite templates must declare this into descriptor)
 	$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
+	$preselectedtypeofcontact = dol_getIdFromCode($db, 'SHIPPING', 'c_type_contact', 'code', 'rowid');
 	foreach ($dirtpls as $reldir)
 	{
 	    $res = @include dol_buildpath($reldir.'/contacts.tpl.php');