Merge pull request #3939 from marcosgdf/bug-3836

FIX #3836 Unable to upload a document to an invoice under some circunstances
This commit is contained in:
Juanjo Menent 2015-11-08 11:21:16 +01:00
commit 7673a73a65
2 changed files with 6 additions and 1 deletions

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1041,6 +1042,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
// Define $destpath (path to file including filename) and $destfile (only filename)
$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
$destfile=$_FILES[$varfiles]['name'];
$savingdocmask = dol_sanitizeFileName($savingdocmask);
if ($savingdocmask)
{
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -48,7 +49,7 @@ if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
//var_dump($modulepart);
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','ficheinter','contract','project','project_task')))
{
$savingdocmask=$object->ref.'-__file__';
$savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
}
/*if (in_array($modulepart,array('member')))
{