diff --git a/ChangeLog b/ChangeLog
index 2e1556ae3e6..de6b3811e40 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,12 +58,16 @@ 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 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.
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 9f0f9089e76..de9fb91a6f3 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 .= "";
+
+ if ($savingdocmask)
+ {
+ $out .= '