Kaynağa Gözat

Work on direct external link for dolibarr objects

Laurent Destailleur 7 yıl önce
ebeveyn
işleme
7178bf0132

+ 9 - 2
htdocs/compta/facture/class/facture.class.php

@@ -1059,13 +1059,20 @@ class Facture extends CommonInvoice
 	 */
 	function getDirectExternalLink($withpicto=0)
 	{
+		global $dolibarr_main_url_root;
+
 		// Define $urlwithroot
 		$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
 		$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;		// This is to use external domain name found into config file
 		//$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
 
-		$url='eee';
-		return '<a href="'.$urlwithroot.'/document.php?modulepart=invoice&" target="_download" rel="noindex, nofollow">'.$this->ref.'</a>';
+		// TODO Read into ecmfile table to get entry and hash exists (PS: If not found, add it)
+		include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
+		$ecmfile=new EcmFiles($this->db);
+		//$result = $ecmfile->get();
+
+		$hashp='todo';
+		return '<a href="'.$urlwithroot.'/document.php?modulepart=invoice&hashp='.$hashp.'" target="_download" rel="noindex, nofollow">'.$this->ref.'</a>';
 	}
 
 	/**

+ 1 - 1
htdocs/document.php

@@ -25,7 +25,7 @@
  *	\file       htdocs/document.php
  *  \brief      Wrapper to download data files
  *  \remarks    Call of this wrapper is made with URL:
- * 				document.php?modulepart=repfichierconcerne&file=pathrelatifdufichier
+ * 				document.php?modulepart=repfichierconcerne&file=relativepathoffile
  * 				document.php?modulepart=logs&file=dolibarr.log
  */
 

+ 11 - 0
htdocs/modulebuilder/template/class/myobject.class.php

@@ -324,6 +324,17 @@ class MyObject extends CommonObject
 		return $result;
 	}
 
+	/**
+	 * Return link to download file from a direct external access
+	 *
+	 * @param	int				$withpicto			Add download picto into link
+	 * @return	string			HTML link to file
+	 */
+	function getDirectExternalLink($withpicto=0)
+	{
+		return 'todo';
+	}
+
 	/**
 	 *  Retourne le libelle du status d'un user (actif, inactif)
 	 *