浏览代码

Fix when using image into description

Laurent Destailleur 6 年之前
父节点
当前提交
189323ad58
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 9 0
      htdocs/core/lib/pdf.lib.php
  2. 2 0
      htdocs/theme/eldy/ckeditor/config.js

+ 9 - 0
htdocs/core/lib/pdf.lib.php

@@ -1175,6 +1175,15 @@ function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hide
 	if (empty($reshook))
 	{
 		$labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline);
+
+		//var_dump($labelproductservice);exit;
+
+		// Fix bug of some HTML editors that replace links <img src="http://localhostgit/viewimage.php?modulepart=medias&file=image/efd.png" into <img src="http://localhostgit/viewimage.php?modulepart=medias&amp;file=image/efd.png"
+		// We make the reverse, so PDF generation has the real URL.
+		$labelproductservice = preg_replace('/(<img[^>]*src=")([^"]*)(&amp;)([^"]*")/', '\1\2&\4', $labelproductservice, -1, $nbrep);
+
+		//var_dump($labelproductservice);exit;
+
 		// Description
 		$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J',true);
 		$result.=$labelproductservice;

+ 2 - 0
htdocs/theme/eldy/ckeditor/config.js

@@ -9,6 +9,8 @@ CKEDITOR.editorConfig = function( config )
 	// http://docs.cksource.com/CKEditor_3.x/Developers_Guide
 	// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
 	config.enterMode = CKEDITOR.ENTER_BR;
+	//config.forceSimpleAmpersand = true;	// When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &amp;. We don't want this. But this option does not fix this.
+	//config.entities = false;			// When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &amp;. We don't want this. But this option does not fix this.
 	config.resize_enabled = false;
 	//config.resize_maxHeight = 3000;
 	//config.resize_maxWidth = 3000;