瀏覽代碼

Merge branch '16.0-mmi' of gogs.iprospective.fr:iProspective/Dolibarr into 16.0-mmi

Mathieu Moulin 1 年之前
父節點
當前提交
d2901785e5

+ 41 - 6
htdocs/core/lib/pdf.lib.php

@@ -635,25 +635,35 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
 
 			// Intra VAT
 			if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) {
-				if ($targetcompany->tva_intra) {
+				// MMI Hack
+				if ($usecontact && is_object($targetcontact) && !empty($targetcontact->array_options['tva_intra']))
+					$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcontact->array_options['tva_intra']);
+				elseif ($targetcompany->tva_intra)
 					$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
-				}
 			}
 
 			// Professionnal Ids
-			if (!empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && !empty($targetcompany->idprof1)) {
+			if (!empty($conf->global->MAIN_PROFID1_IN_ADDRESS)) {
 				$tmp = $outputlangs->transcountrynoentities("ProfId1", $targetcompany->country_code);
 				if (preg_match('/\((.+)\)/', $tmp, $reg)) {
 					$tmp = $reg[1];
 				}
-				$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
+				// MMI Hack
+				if ($usecontact && is_object($targetcontact) && !empty($targetcontact->array_options['options_siren']))
+					$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($targetcontact->array_options['options_siren']);
+				elseif (!empty($targetcompany->idprof1))
+					$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
 			}
-			if (!empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && !empty($targetcompany->idprof2)) {
+			if (!empty($conf->global->MAIN_PROFID2_IN_ADDRESS)) {
 				$tmp = $outputlangs->transcountrynoentities("ProfId2", $targetcompany->country_code);
 				if (preg_match('/\((.+)\)/', $tmp, $reg)) {
 					$tmp = $reg[1];
 				}
-				$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
+				// MMI Hack
+				if ($usecontact && is_object($targetcontact) && !empty($targetcontact->array_options['options_siret']))
+					$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($targetcontact->array_options['options_siret']);
+				elseif (!empty($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);
@@ -1691,6 +1701,31 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
 		if ($prodser->barcode)
 			$libelleproduitservice .= '__N__  Barcode: '.$prodser->barcode;
 	}
+	// Show Location
+	if (in_array($objecttype, ['Expedition']) && !empty($conf->global->SHIPPING_PDF_LOCATION) && !empty($conf->categorie->enabled)) {
+		if (!empty($prodser->array_options['options_fk_categorie'])) {
+			include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+			$categorie = new Categorie($db);
+			$categorie->fetch($prodser->array_options['options_fk_categorie']);
+			$categorie_parent = $categorie;
+			while(empty($categorie_parent->array_options['options_fk_entrepot_loc']) && !empty($categorie_parent->fk_parent)) {
+				$fk_parent = $categorie_parent->fk_parent;
+				$categorie_parent = new Categorie($db);
+				$categorie_parent->fetch($fk_parent);
+			}
+			if(!empty($categorie_parent->array_options['options_fk_entrepot_loc'])) {
+				$sql = 'SELECT label
+					FROM '.MAIN_DB_PREFIX.'c_entrepot_loc
+					WHERE rowid='.$categorie_parent->array_options['options_fk_entrepot_loc'];
+				$q = $db->query($sql);
+				list($entrepot_loc) = $q->fetch_row();
+				$libelleproduitservice .= '__N__  Localisation: '.$entrepot_loc.' -> '.$categorie->label;
+			}
+			else
+				$libelleproduitservice .= '__N__  Localisation: '.$categorie->label;
+			//var_dump($prodser->array_options['options_fk_categorie']); die();
+		}
+	}
 
 	// Now we convert \n into br
 	if (dol_textishtml($libelleproduitservice)) {

+ 2 - 2
htdocs/core/modules/expedition/doc/pdf_espadon.modules.php

@@ -593,7 +593,7 @@ class pdf_espadon extends ModelePdfExpedition
 
 
 						if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) {
-							$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
+							$pdf->Image($realpatharray[$i], $this->getColumnContentXStart('photo'), $curY + 1, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, !empty($conf->global->MAIN_SHIPPING_PDF_IMAGE_DPI) ?$conf->global->MAIN_SHIPPING_PDF_IMAGE_DPI :300); // Use 300 dpi
 							// $pdf->Image does not increase value return by getY, so we save it manually
 							$posYAfterImage = $curY + $imglinesize['height'];
 						}
@@ -1057,7 +1057,7 @@ class pdf_espadon extends ModelePdfExpedition
 		$pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending")." : ".$object->ref, '', 'R');
 
 		// Date planned delivery
-		if (!empty($object->date_delivery)) {
+		if (empty($conf->global->SHIPPING_PDF_HIDE_DELIVERY_DATE) && !empty($object->date_delivery)) {
 				$posy += 4;
 				$pdf->SetXY($posx, $posy);
 				$pdf->SetTextColor(0, 0, 60);

+ 9 - 1
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -2410,9 +2410,17 @@ class pdf_sponge extends ModelePDFFactures
 					$usecontact = true;
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
+				// If BILLING contact defined, we use it
+				if (! $usecontact) {
+					$arrayidcontact = $object->getIdContact('external', 'BILLING');
+					if (count($arrayidcontact) > 0) {
+						$usecontact = true;
+						$result = $object->fetch_contact($arrayidcontact[0]);
+					}
+				}
 
 				// Recipient name
-				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)))) {
+				if ($usecontact && ($object->contact->socid == $object->thirdparty->id && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT))) {
 					$thirdparty = $object->contact;
 				} else {
 					$thirdparty = $object->thirdparty;

+ 1 - 1
htdocs/custom/mmidocuments

@@ -1 +1 @@
-Subproject commit d498264a6713adeabe6761bb72336686a6ec7e77
+Subproject commit 6abd62e8b68ee16f2fe54d39da91d33458879615

+ 1 - 1
htdocs/custom/mmientrepots

@@ -1 +1 @@
-Subproject commit 6a531c5c5c0523e28342ef994868a3f25cbba3a6
+Subproject commit 8a21c260c45de8e954973e9d6c843e571601f0fa

+ 1 - 1
htdocs/custom/mmiprestasync

@@ -1 +1 @@
-Subproject commit 16d8ff6eb8eb797d442b581a2dedfc816c58c6ad
+Subproject commit 399cfc204794a7234e0cadfe50ae09c1bc7c1402

+ 9 - 0
htdocs/product/composition/card.php

@@ -371,6 +371,10 @@ if ($id > 0 || !empty($ref)) {
 		if (!empty($conf->stock->enabled)) {
 			print '<td class="right">'.$langs->trans('Stock').'</td>';
 		}
+		// Other fields
+		$parameters = array();
+		$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
+		print $hookmanager->resPrint;
 		// Qty in kit
 		print '<td class="center">'.$langs->trans('Qty').'</td>';
 		// Stoc inc/dev
@@ -447,6 +451,11 @@ if ($id > 0 || !empty($ref)) {
 						print '<td class="right">'.$value['stock'].'</td>'; // Real stock
 					}
 
+					// Other fields
+					$parameters = array('value'=>&$value, 'prods_arbo'=>$prods_arbo);
+					$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
+					print $hookmanager->resPrint;
+
 					// Qty + IncDec
 					if ($user->rights->produit->creer || $user->rights->service->creer) {
 						print '<td class="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" class="right" /></td>';