Fix: wrong image path with multicompany sharing

This commit is contained in:
Regis Houssin 2018-01-10 12:52:30 +01:00
parent 4cc0e889c1
commit 4683a35532
2 changed files with 10 additions and 11 deletions

View File

@ -279,15 +279,13 @@ if (empty($reshook))
$action = 'edit'; $action = 'edit';
} }
if (! $error)
{
$contactid=GETPOST("contactid",'int');
$object->fetch($contactid);
if (! $error) // Photo save
{ $dir = $conf->societe->multidir_output[$object->entity]."/contact/".$object->id."/photos";
$contactid=GETPOST("contactid",'int');
$object->fetch($contactid);
// Photo save
$dir = $conf->societe->dir_output."/contact/".$object->id."/photos";
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
if (GETPOST('deletephoto') && $object->photo) if (GETPOST('deletephoto') && $object->photo)
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.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
@ -69,7 +70,7 @@ if (! $sortfield) $sortfield="name";
if ($id > 0) $object->fetch($id); if ($id > 0) $object->fetch($id);
$upload_dir = $conf->societe->dir_output.'/contact/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->societe->multidir_output[$object->entity].'/contact/'.dol_sanitizeFileName($object->ref);
$modulepart='contact'; $modulepart='contact';