diff --git a/ChangeLog b/ChangeLog
index 2e1556ae3e6208bd85c9d80c87cdaca94b2624cb..3a04104b128d3a6337a52c8309a45da37df2547f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,13 +39,11 @@ For users:
 - New: [ task #165 ] Add import/export of multiprices.
 - New: Add Maghreb regions and departments.
 - New: A more responsive desgin for statistic box of home page.
-- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
 - New: [ task #1005 ] Adapting to Spanish legislation bill numbering
 - New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode.
 - New: [ task #1014 ] Add option to recursivly add parent category.
 - New: [ task #1016 ] Can define a specific numbering for deposits.
 - New: [ task #918 ] Stock replenishment.
-- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count.
 - New : Add pdf link into supplier invoice list and supplier order list.
 - New : Genrate auto the PDF for supplier invoice.
 - New : Add category into filter webservice thirdparty method getListOfThirdParties.
@@ -60,17 +58,22 @@ For users:
 - New: Add hidden option MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS.
 - New: Can send an email from thirdparty card.
 - New: Can cancel holidays that were previously validated.
-- Fix: [bug #1022] correct margin calculation for credit notes.
 - New: Can choose contact on event (action com) creation, and filtred by thirdparty.
 - New: Add hidden option MAIN_FORCE_DEFAULT_STATE_ID.
 - New: Add page to make mass stock movement.
 - New: Add field oustanding limit into thirdparty properties.
 - New: Can enter a vat payment of zero.
+- New: Add path to installed dir of external modules + Name and web of module provider.
+- New: Add option to use a specific mask for uploaded filename
+- Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error).
+- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count.
+- Fix: [ bug #1022 ] correct margin calculation for credit notes.
+- Fix: Better management of using ajax for upload form (to solve problem when enabling ajax jquery multifile upload in some cases).
 
 For translators:
 - Qual: Normalized sort order of all languages files with english reference files.
-- New: Add language code files for South Africa, France new caledonia.
-- New: Translate the email to change password.
+- New: Add language code files for South Africa, France new caledonia, Vietnam.
+- New: Translate string for email to change password.
 
 For developers:
 - New: DolGraph can build graph with three lines.
@@ -86,7 +89,6 @@ For developers:
   MAIN_MOTD_SETUPPAGE, MAIN_MOTD_SETUPPAGE, MAIN_HOME now accept "|langfile" into translation
   key to use a specific language file.
 - New: Make some changes to allow usage of several alternative $dolibarr_main_url_root variables.
-  Fix also several bugs with old code. 
 - Qual: All nowrap properties are now using CSS class nowrap.
 - Qual: Move hardcoded code of module mailmanspip into trigger.
 - New: Into POST forms, if you can add a parameter DOL_AUTOSET_COOKIE with a vlue that is list name,
@@ -97,6 +99,7 @@ For developers:
 - New: A trigger can return an array of error strings instead of one error string.
 - New: Add method to use a dictionnary as a combo box.
 - New: Add update method for web service product.
+- Fix also several bugs with old code. 
 
 WARNING: Following change may create regression for some external modules, but was necessary to make
 Dolibarr better:
diff --git a/build/debian/README.howto b/build/debian/README.howto
index 6f06f5ab91b74b0a949fd725b72e63fd92522139..7108f0a381f466f11e27e891db128dc9424e934d 100644
--- a/build/debian/README.howto
+++ b/build/debian/README.howto
@@ -8,6 +8,9 @@ script to build a package, ready to be distributed,
 with format .DEB (for Debian, Ubuntu, ...).
 
 
+
+##### Prepare linux env to work
+
 # To build a debian package, you need first
 # With Ubuntu 12.04
 # apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
@@ -41,6 +44,9 @@ END
 * Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
 
 
+
+##### Some interesting command to know
+
 # To translate .po files
 # debconf-updatepo					     		To run into po dir to regenate templates.pot
 # podebconf-report-po --from email@email.com	To send email to ask translations
@@ -66,9 +72,8 @@ END
 # gdebi package.deb						 Install a package + dependencies
 
 
-##########################################################
 
-To submit a package to Debian:
+##### Global view of submit new package to Debian:
 
 - Post an ITP with reportbugs :
 > reportbug -B debian --email username@domain.tld wnpp
@@ -90,19 +95,28 @@ http://bugs.debian.org/package
 
 
 
-##########################################################
-
-To generate a package
+##### Testing a package into unstable env
 
 Create a chroot called "unstable-amd64-sbuild"
 > sudo sbuild-createchroot --keyring= unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian
 
+Pour lister les env chroot
+> schroot -l
+
 Puis pour se connecter 
-> schroot
+> schroot -c name_of_chroot
+
+Pour tester un package
+> cp *.deb /srv/chroot/unstable/tmp
+> schroot -c name_of_chroot
+> dpkg -i dolibarr*.deb
+> sudo apt-get install -f
+
 
 
 
-##########################################################
+
+##### Create/Maintain TCPDF package
 
 To update tcpdf package:
 
@@ -128,7 +142,7 @@ from origin/upstream and origin/pristine.
 Note: If there was errors solved manually, you may need to make a git commit
 
 * Add an entry into debian/changelog
-> dh "My comment" will add entry.
+> dch -v x.y.z-1 "My comment" will add entry.
 For example: dch -v x.y.z-1 "New upstream release." for a new version
 
 Warning: Date must have format reported by "date -R"
@@ -157,7 +171,8 @@ http://packages.qa.debian.org/t/tcpdf.html
 * Package will be into release when test will be moved as stable.
 
 
-##########################################################
+
+##### Create/Maintain dolibarr package
 
 To update dolibarr debian package
 
@@ -183,7 +198,7 @@ from origin/upstream and origin/pristine.
 Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
 
 * Add an entry into debian/changelog
-> dh "My comment" will add entry.
+> dch -v x.y.z-1 "My comment" will add entry.
 For example: dch -v x.y.z-1 "New upstream release." for a new version
 Then modify changelog to replace "unstable" with "UNRELEASED".
 
diff --git a/build/obs/README b/build/obs/README
index c7dda9093f152aa5978736071222c131edd8d1a1..56589299b896698c243afc914da4dbb744517709 100644
--- a/build/obs/README
+++ b/build/obs/README
@@ -23,12 +23,13 @@ To submit a snapshot for building, we should have a service file with content
   <service name="download_src_package">
     <param name="host">www.dolibarr.org</param>
     <param name="protocol">http</param>
-    <param name="path">/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm</param>
+    <param name="path">/files/stable/package_rpm_generic/dolibarr-x.y.z-3.src.rpm</param>
   </service>
 </services>
 
-How to have such a service ?
-Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm
+How to have such a service file created automatically ?
+Click on "Add file", then select mode "Upload From: Remote URL"
+Enter the Remote URL that should looks like this: http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-3.src.rpm
 
 Then add into advanded - attributes
 OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png
diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec
index 2418698e12d5905f8baba5e2982a1d2e62199877..609a5d27158a43369d6ec97300b593451111942e 100755
--- a/build/rpm/dolibarr_generic.spec
+++ b/build/rpm/dolibarr_generic.spec
@@ -464,7 +464,11 @@ echo Restart mysql server
 	/sbin/service mysqld restart
 %else
 %if 0%{?suse_version}
+if [ -f /etc/init.d/mysqld ]; then
+    /etc/init.d/mysqld restart
+else
 	/sbin/service mysql restart
+fi
 %else
 if [ -f /etc/init.d/mysqld ]; then
     /etc/init.d/mysqld restart
diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec
index bdfb0eab0af64dfe416827ef7736bb0cea427dcf..692114e508ba40d9f131a205992986e74f236cf9 100755
--- a/build/rpm/dolibarr_opensuse.spec
+++ b/build/rpm/dolibarr_opensuse.spec
@@ -288,7 +288,11 @@ fi
 
 # Restart mysql
 echo Restart mysql
-/sbin/service mysql restart
+if [ -f /etc/init.d/mysqld ]; then
+    /etc/init.d/mysqld restart
+else
+	/sbin/service mysql restart
+fi
 
 # Show result
 echo
diff --git a/doc/images/dolibarr_screenshot1_300x188.png b/doc/images/dolibarr_screenshot1_300x188.png
new file mode 100644
index 0000000000000000000000000000000000000000..51c949ee67e4b1e9f81bacff33fde86dc968939d
Binary files /dev/null and b/doc/images/dolibarr_screenshot1_300x188.png differ
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 4aca54817e816483c8530013fd6c5433d7ac2137..b4e6ff2f628e1459a5a626b25473e88d8744d36b 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2003      Jean-Louis Bergamo   <jlb@j1b.org>
- * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2004      Eric Seigne          <eric.seigne@ryxeo.com>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2011	   Juanjo Menent        <jmenent@2byte.es>
@@ -154,22 +154,21 @@ foreach ($modulesdir as $dir)
     					$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
     					if ($objMod->version == 'development'  && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
     					if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
-						// We discard modules according to property disabled						
+						// We discard modules according to property disabled
     					if (isset($objMod->hidden) && $objMod->hidden) $modulequalified=false;
-    					
+
     					// Define array $categ with categ with at least one qualified module
     					if ($modulequalified)
     					{
     						$modules[$i] = $objMod;
     			            $filename[$i]= $modName;
     			            $orders[$i]  = $objMod->family."_".$j;   // Sort by family, then by module number
-    			            $special     = isset($specialtostring[$objMod->special])?$specialtostring[$objMod->special]:'unknown';
+    						$dirmod[$i]  = $dir;
+    			            // Set categ[$i]
+    						$special     = isset($specialtostring[$objMod->special])?$specialtostring[$objMod->special]:'unknown';
     			            if ($objMod->version == 'development' || $objMod->version == 'experimental') $special='expdev';
-
-    						//print "x".$modName." ".$orders[$i]." ".$special."\n<br>";
     						if (isset($categ[$special])) $categ[$special]++;					// Array of all different modules categories
     			            else $categ[$special]=1;
-    						$dirmod[$i] = $dir;
     						$j++;
     			            $i++;
     					}
@@ -337,7 +336,7 @@ if ($mode != 'marketplace')
         // Print a separator if we change family
         //print "<tr><td>xx".$oldfamily."-".$family."-".$atleastoneforfamily."<br></td><tr>";
         //if ($oldfamily && $family!=$oldfamily && $atleastoneforfamily) {
-        if ($family!=$oldfamily) 
+        if ($family!=$oldfamily)
         {
             print '<tr class="liste_titre">'."\n";
             print '<td colspan="5">';
@@ -391,7 +390,16 @@ if ($mode != 'marketplace')
 
         // Version
         print '<td align="center" valign="top" class="nowrap">';
-        print $objMod->getVersion();
+        $version=$objMod->getVersion();
+        $dirofmodule=$dirmod[$key];
+        if ($objMod->isCoreOrExternalModule() == 'external')
+        {
+        	$text=$langs->trans("ExternalModule",$dirofmodule);
+        	if (! empty($objMod->editor_name) && $objMod->editor_name != 'dolibarr') $text.=' - '.$objMod->editor_name;
+        	if (! empty($objMod->editor_web) && $objMod->editor_web != 'www.dolibarr.org') $text.=' - '.$objMod->editor_web;
+        	print $form->textwithpicto($version, $text, 1, 'help');
+        }
+        else print $version;
         print "</td>\n";
 
         // Activate/Disable and Setup (2 columns)
@@ -401,7 +409,6 @@ if ($mode != 'marketplace')
 
         	print '<td align="center" valign="middle">';
 
-        	// Module actif
         	if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1)))
         	{
         		print $langs->trans("Required");
@@ -459,7 +466,7 @@ if ($mode != 'marketplace')
 
         }
         else
-        {
+		{
         	print '<td align="center" valign="middle">';
 
         	if (! empty($objMod->always_enabled))
diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php
index 8f4f0045f60f434299dadbb542f629bc0e5bf73d..6b1ebc5ac14c192eb7f3703e270776241b0fb641 100644
--- a/htdocs/commande/liste.php
+++ b/htdocs/commande/liste.php
@@ -362,7 +362,7 @@ if ($resql)
 				if (($objp->fk_statut > 0 && $objp->fk_statut < 3) || ($objp->fk_statut == 3 && $objp->facturee == 0))
 				{
 					print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$companystatic->id.'">';
-					print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->nom, 'object_bill', 'hideonsmrtphone').'</a>';
+					print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->nom, 'object_bill', 'hideonsmartphone').'</a>';
 				}
 			}
 		}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 97ba9ccbcd730b863cb658798b1e8b8975031acc..f8949593e43e41e34529067e56ce53c06ee76674 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3719,9 +3719,10 @@ class Form
      *	@param  int		$translate		Translate and encode value
      * 	@param	int		$maxlen			Length maximum for labels
      * 	@param	int		$disabled		Html select box is disabled
+     *  @param	int		$sort			'ASC' or 'DESC' =Sort on label, '' or 'NONE'=Do not sort
      * 	@return	string					HTML select string
      */
-    function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0)
+    function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0, $sort='')
     {
         global $langs;
 
@@ -3736,28 +3737,30 @@ class Form
 
         if (is_array($array))
         {
+        	// Translate
+        	if ($translate)
+        	{
+	        	foreach($array as $key => $value) $array[$key]=$langs->trans($value);
+        	}
+
+        	// Sort
+			if ($sort == 'ASC') asort($array);
+			elseif ($sort == 'DESC') arsort($array);
+
             foreach($array as $key => $value)
             {
                 $out.='<option value="'.$key.'"';
-                // Si il faut pre-selectionner une valeur
-                if ($id != '' && $id == $key)
-                {
-                    $out.=' selected="selected"';
-                }
-
+                if ($id != '' && $id == $key) $out.=' selected="selected"';		// To preselect a value
                 $out.='>';
 
-                $newval=($translate?$langs->trans(ucfirst($value)):$value);
                 if ($key_in_label)
                 {
-                    $selectOptionValue = dol_htmlentitiesbr($key.' - '.($maxlen?dol_trunc($newval,$maxlen):$newval));
+                    $selectOptionValue = dol_htmlentitiesbr($key.' - '.($maxlen?dol_trunc($value,$maxlen):$value));
                 }
                 else
                 {
-                    $selectOptionValue = dol_htmlentitiesbr($maxlen?dol_trunc($newval,$maxlen):$newval);
-                    if ($value == '' || $value == '-') {
-                        $selectOptionValue='&nbsp;';
-                    }
+                    $selectOptionValue = dol_htmlentitiesbr($maxlen?dol_trunc($value,$maxlen):$value);
+                    if ($value == '' || $value == '-') $selectOptionValue='&nbsp;';
                 }
                 $out.=$selectOptionValue;
                 $out.="</option>\n";
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 9f0f9089e7671ab177e7b9410d3cf1451fe36f3d..de9fb91a6f3a870648c1689b403a883401e80367 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -59,19 +59,23 @@ class FormFile
      *  @param  int		$size           Length of input file area
      *  @param	Object	$object			Object to use (when attachment is done on an element)
      *  @param	string	$options		Options
-     *  @param	boolean	$useajax		Use ajax if enabled
+     *  @param	boolean	$useajax		Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
+     *  @param	string	$savingdocmask	Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
      * 	@return	int						<0 if KO, >0 if OK
      */
-    function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=true)
+    function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='')
     {
         global $conf,$langs, $hookmanager;
         $hookmanager->initHooks(array('formfile'));
 
         if (! empty($conf->browser->phone)) return 0;
 
-		if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax)
+		if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2))
         {
-            return $this->_formAjaxFileUpload($object);
+        	// TODO: Cheeck this works with 2 forms on same page
+        	// TODO: Cheeck this works with GED module, otherwise, force useajax to 0
+        	// TODO: This does not support option savingdocmask
+        	return $this->_formAjaxFileUpload($object);
         }
         else
         {
@@ -133,6 +137,17 @@ class FormFile
                 $out .= ' ('.$langs->trans("UploadDisabled").')';
             }
             $out .= "</td></tr>";
+            
+            if ($savingdocmask)
+            {
+            	$out .= '<tr>';
+   	            if (! empty($options)) $out .= '<td>'.$options.'</td>';
+	            $out .= '<td valign="middle" class="nowrap">';
+				$out .= '<input type="checkbox" checked="checked" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/',$langs->transnoentitiesnoconv("OriginFileName"),$savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));	            
+            	$out .= '</td>';
+            	$out .= '</tr>';	
+            }
+            
             $out .= "</table>";
 
             $out .= '</form>';
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 4494a5d1ff88b3f59c5fe0b2d8552f21cc008869..b2a19b2dfeb3c463bae926118a9d700651a0d071 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -994,18 +994,28 @@ function dol_init_file_process($pathtoscan='')
  * @param	int		$allowoverwrite			1=Allow overwrite existing file
  * @param	int		$donotupdatesession		1=Do no edit _SESSION variable
  * @param	string	$varfiles				_FILES var name
+ * @param	string	$savingdocmask			Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
  * @return	void
  */
-function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=0,$varfiles='addedfile')
+function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='')
 {
 	global $db,$user,$conf,$langs;
 
 	if (! empty($_FILES[$varfiles])) // For view $_FILES[$varfiles]['error']
 	{
-		dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession, LOG_DEBUG);
+		dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG);
 		if (dol_mkdir($upload_dir) >= 0)
 		{
-			$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $upload_dir . "/" . $_FILES[$varfiles]['name'], $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
+			// Define $destpath (path to file including filename) and $destfile (only filename)
+			$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
+			$destfile=$_FILES[$varfiles]['name'];
+			if ($savingdocmask) 
+			{
+				$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
+				$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
+			} 
+			
+			$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
 			if (is_numeric($resupload) && $resupload > 0)
 			{
 				include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
@@ -1013,16 +1023,16 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
 				{
 					include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
 					$formmail = new FormMail($db);
-					$formmail->add_attached_files($upload_dir . "/" . $_FILES[$varfiles]['name'],$_FILES[$varfiles]['name'],$_FILES[$varfiles]['type']);
+					$formmail->add_attached_files($destpath, $destfile, $_FILES[$varfiles]['type']);
 				}
-				if (image_format_supported($upload_dir . "/" . $_FILES[$varfiles]['name']) == 1)
+				if (image_format_supported($destpath) == 1)
 				{
 					// Create small thumbs for image (Ratio is near 16/9)
 					// Used on logon for example
-					$imgThumbSmall = vignette($upload_dir . "/" . $_FILES[$varfiles]['name'], 160, 120, '_small', 50, "thumbs");
+					$imgThumbSmall = vignette($destpath, 160, 120, '_small', 50, "thumbs");
 					// Create mini thumbs for image (Ratio is near 16/9)
 					// Used on menu or for setup page for example
-					$imgThumbMini = vignette($upload_dir . "/" . $_FILES[$varfiles]['name'], 160, 120, '_mini', 50, "thumbs");
+					$imgThumbMini = vignette($destpath, 160, 120, '_mini', 50, "thumbs");
 				}
 
 				setEventMessage($langs->trans("FileTransferComplete"));
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index 12f739331b8d6ce7706fb4fee0aacf64ad5a8a27..79e515b05e5d70e37667acaafbce750d8a0a0dd1 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -262,7 +262,7 @@ abstract class DolibarrModules
 
 
     /**
-     *  Retourne la version du module.
+     *  Return module version.
      *  Pour les modules a l'etat 'experimental', retourne la traduction de 'experimental'
      *  Pour les modules 'dolibarr', retourne la version de Dolibarr
      *  Pour les autres modules, retourne la version du module
@@ -282,6 +282,20 @@ abstract class DolibarrModules
     }
 
 
+    /**
+     *  Return if a module is a core or external module
+     *
+     *  @return     string      'core', 'external' or 'unknown'
+     */
+    function isCoreOrExternalModule()
+    {
+        if ($this->version == 'dolibarr') return 'core';
+        if (! empty($this->version) && ! in_array($this->version,array('experimental','development'))) return 'external';
+        if (! empty($this->editor_name) || ! empty($this->editor_web)) return 'external';
+        return 'unknown';
+    }
+
+
     /**
      *  Return list of lang files related to module
      *
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 8ba991076f1ff4db82f956074f43c2428cdabdd2..12daf37060c02150e0ba88a54aece707d15bcbbb 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -74,8 +74,9 @@ if ($object->fetch($id, $ref))
 // Envoi fichier
 if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
 {
-    if ($object->id > 0) {
-    	dol_add_file_process($upload_dir, 0, 1, 'userfile');
+    if ($object->id > 0) 
+    {
+    	dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask'));
     }
 }
 
@@ -197,9 +198,10 @@ if ($object->id > 0)
 	print '</table>';
 	print '</div>';
 
+	
 	// Affiche formulaire upload
 	$formfile=new FormFile($db);
-	$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?facid='.$object->id,'',0,0,$user->rights->fournisseur->facture->creer, 50, $object);
+	$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?facid='.$object->id, '', 0, 0, $user->rights->fournisseur->facture->creer, 50, $object, '', 0, dol_sanitizeFileName($object->ref.'_'.$object->ref_supplier.'___file__'));
 
 
 	// List of document
diff --git a/htdocs/includes/tcpdf/fonts/aealarabiya.ctg.z b/htdocs/includes/tcpdf/fonts/aealarabiya.ctg.z
new file mode 100644
index 0000000000000000000000000000000000000000..b837d85bce0f366dabc4aedb92c10355bb97cdd3
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aealarabiya.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/aealarabiya.z b/htdocs/includes/tcpdf/fonts/aealarabiya.z
new file mode 100644
index 0000000000000000000000000000000000000000..fc16a2a1f9206c11d9f4d96003500be5ff02d785
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aealarabiya.z differ
diff --git a/htdocs/includes/tcpdf/fonts/aefurat.ctg.z b/htdocs/includes/tcpdf/fonts/aefurat.ctg.z
new file mode 100644
index 0000000000000000000000000000000000000000..1b5a507cc4bc98ccbfce59d649183c230cb41016
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aefurat.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/aefurat.z b/htdocs/includes/tcpdf/fonts/aefurat.z
new file mode 100644
index 0000000000000000000000000000000000000000..5089d15afd4be9831abe8afcae5bc71e766fa9d7
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/aefurat.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavuserifi.z b/htdocs/includes/tcpdf/fonts/dejavuserifi.z
new file mode 100644
index 0000000000000000000000000000000000000000..7c1128490aea1807935ff41e186f2117debcb1f8
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavuserifi.z differ
diff --git a/htdocs/langs/cs_CZ/printipp.lang b/htdocs/langs/cs_CZ/printipp.lang
index e8aac6b848fe66daef437a69947bbf9d7e3c97b2..7ef2cd5649db3aa2577eef4f9084ecafc609b718 100644
--- a/htdocs/langs/cs_CZ/printipp.lang
+++ b/htdocs/langs/cs_CZ/printipp.lang
@@ -1,18 +1,18 @@
-/*
- * Language code: cs_CZ
- * Automatic generated via autotranslator.php tool
- * Generation date 2013-10-26 11:58:10
- */
-
-
-// START - Lines generated via autotranslator.php tool (2013-10-26 11:58:10).
-// Reference language: en_US -> cs_CZ
-PrintIPPSetup=Nastavení modulu Přímý tisk
-PrintIPPDesc=Ce modul Permet d'un ajouter Bouton d'dojem přímé des dokumenty vers votre imprimante. Il requiert un systeme Linux Equipe de poháry.
-PRINTIPP_ENABLED=Zobrazit Piktogram &quot;Přímý tisk&quot; do seznamu dokumentů
-PRINTIPP_HOST=Tiskový server
-PRINTIPP_PORT=Přístav
-PRINTIPP_USER=Přihlášení
-PRINTIPP_PASSWORD=Heslo
-NoPrinterFound=Žádné tiskárny nalezeny (zkontrolujte poháry Nasta)
-// STOP - Lines generated via autotranslator.php tool (2013-10-26 12:39:36).
+/*
+ * Language code: cs_CZ
+ * Automatic generated via autotranslator.php tool
+ * Generation date 2013-10-26 11:58:10
+ */
+
+
+// START - Lines generated via autotranslator.php tool (2013-10-26 11:58:10).
+// Reference language: en_US -> cs_CZ
+PrintIPPSetup=Nastavení modulu Přímý tisk
+PrintIPPDesc=Ce modul Permet d'un ajouter Bouton d'dojem přímé des dokumenty vers votre imprimante. Il requiert un systeme Linux Equipe de poháry.
+PRINTIPP_ENABLED=Zobrazit Piktogram &quot;Přímý tisk&quot; do seznamu dokumentů
+PRINTIPP_HOST=Tiskový server
+PRINTIPP_PORT=Přístav
+PRINTIPP_USER=Přihlášení
+PRINTIPP_PASSWORD=Heslo
+NoPrinterFound=Žádné tiskárny nalezeny (zkontrolujte poháry Nasta)
+// STOP - Lines generated via autotranslator.php tool (2013-10-26 12:39:36).
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index c800925fa2f6bc296b348491d6d776f5988a5f44..e723501126317c7df2374a771d15d6735f5e9836 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -379,6 +379,7 @@ LinkToTest=Clickable link generated for user <strong>%s</strong> (click phone nu
 KeepEmptyToUseDefault=Keep empty to use default value
 DefaultLink=Default link
 ValueOverwrittenByUserSetup=Warning, this value may be overwritten by user specific setup (each user can set his own clicktodial url)
+ExternalModule=External module - Installed into directory %s
 
 # Modules
 Module0Name=Users & groups
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 32c57d91c07856a48672c295fcbc039f29333313..613598fa68f82f360f3b2e4456db1ebc6e921712 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -658,6 +658,8 @@ from=from
 toward=toward
 Access=Access
 HelpCopyToClipboard=Use Ctrl+C to copy to clipboard
+SaveUploadedFileWithMask=Save file on server with name "<strong>%s</strong>" (otherwise "%s")
+OriginFileName=Nom d'origine
 
 # Week day
 Monday=Monday
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 70987dbc5ddb71b2f7b0c590128f17eceb035c1a..9984beaf50324ac81182de3c3f8465856ea7a33f 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -379,6 +379,7 @@ LinkToTest=Lien cliquable généré pour l'utilisateur <strong>%s</strong> (cliq
 KeepEmptyToUseDefault=Laisser ce champ vide pour utiliser la valeur par défaut
 DefaultLink=Lien par défaut
 ValueOverwrittenByUserSetup=Attention, cette valeur peut être écrasée par une valeur spécifique à la configuration de l'utilisateur (chaque utilisateur pouvant avoir sa propre URL « clicktodial »)
+ExternalModule=Module externe - Installé dans le répertoire %s
 
 # Modules
 Module0Name=Utilisateurs & groupes
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index bb015c0ebdf1c00bf24bc7661634215fe2e03e15..d73598447ee6c87c478e1b371e220cbd12ba6131 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -658,6 +658,8 @@ from=de
 toward=vers
 Access=Accès
 HelpCopyToClipboard=Utilisez Ctrl+C pour copier dans le presse-papier
+SaveUploadedFileWithMask=Sauver le fichier sur le serveur sous le nom "<strong>%s</strong>" (sinon "%s")
+OriginFileName=nom du fichier source
 
 # Week day
 Monday=Lundi
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 67c58c9d66476005183b39e52521cf9a16ad863d..fb273b79ab368e0409a5e36bf5d30d48d59f92b0 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -910,11 +910,11 @@ else
 
         // Type - Size
         print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>'."\n";
-        print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id);
+        print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
         if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
         print '</td>';
         print '<td>'.$langs->trans("Staff").'</td><td>';
-        print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id);
+        print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id);
         if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
         print '</td></tr>';
 
@@ -1360,7 +1360,7 @@ else
 
             // Type - Size
             print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
-            print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id);
+            print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
             if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
             print '</td>';
             print '<td>'.$langs->trans("Staff").'</td><td>';