FIX #3836 Unable to upload a document to an invoice under some circunstances
This commit is contained in:
parent
87a102f5c8
commit
84a152dc2e
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1041,10 +1042,13 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
// Define $destpath (path to file including filename) and $destfile (only filename)
|
// Define $destpath (path to file including filename) and $destfile (only filename)
|
||||||
$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
|
$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
|
||||||
$destfile=$_FILES[$varfiles]['name'];
|
$destfile=$_FILES[$varfiles]['name'];
|
||||||
|
|
||||||
|
$savingdocmask = dol_sanitizeFileName($savingdocmask);
|
||||||
|
|
||||||
if ($savingdocmask)
|
if ($savingdocmask)
|
||||||
{
|
{
|
||||||
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
||||||
$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
$destfile=dol_osencode(preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask));
|
||||||
}
|
}
|
||||||
|
|
||||||
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* 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
|
* 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
|
* 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);
|
//var_dump($modulepart);
|
||||||
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','ficheinter','contract','project','project_task')))
|
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')))
|
/*if (in_array($modulepart,array('member')))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user