diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 6bb6334e085..109d2c5d23d 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1029,7 +1029,7 @@ class FormFile
{
// Delete or view link
// ($param must start with &)
- print '
';
+ print ' | ';
if ($useinecm)
{
print ''.img_view('default', 0, 'class="paddingrightonly"').'';
@@ -1039,10 +1039,10 @@ class FormFile
$newmodulepart=$modulepart;
if (in_array($modulepart, array('product','produit','service'))) $newmodulepart='produit|service';
- $disablecrop=0;
- if ($modulepart == 'expensereport') $disablecrop=1; // TODO Remove this in future
+ $disablecrop=1;
+ if (in_array($modulepart, array('product','produit','service','holiday','project'))) $disablecrop=0;
- if (image_format_supported($file['name']) > 0 && ! $disablecrop)
+ if (! $disablecrop && image_format_supported($file['name']) > 0)
{
if ($permtoeditline)
{
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 85f98918530..3d241b6d5e4 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -46,14 +46,19 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv
if ($modulepart=='produit|service' && (! $user->rights->produit->lire && ! $user->rights->service->lire)) accessforbidden();
$accessallowed=1;
}
+elseif ($modulepart == 'project')
+{
+ $result=restrictedArea($user,'projet',$id);
+ if (! $user->rights->projet->lire) accessforbidden();
+ $accessallowed=1;
+}
elseif ($modulepart == 'holiday')
{
$result=restrictedArea($user,'holiday',$id,'holiday');
- if ($modulepart=='holiday' && (! $user->rights->holiday->read)) accessforbidden();
+ if (! $user->rights->holiday->read) accessforbidden();
$accessallowed=1;
}
-
// Security:
// Limit access if permissions are wrong
if (! $accessallowed)
@@ -75,6 +80,17 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv
if ($object->type == Product::TYPE_SERVICE) $dir=$conf->service->multidir_output[$object->entity];
}
}
+elseif ($modulepart == 'project')
+{
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ $object = new Project($db);
+ if ($id > 0)
+ {
+ $result = $object->fetch($id);
+ if ($result <= 0) dol_print_error($db,'Failed to load object');
+ $dir=$conf->projet->dir_output; // By default
+ }
+}
elseif ($modulepart == 'holiday')
{
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
@@ -87,6 +103,13 @@ elseif ($modulepart == 'holiday')
}
}
+if (empty($backtourl))
+{
+ if (in_array($modulepart, array('product','produit','service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
+ else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
+ else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]);
+}
+
/*
* Actions
@@ -101,8 +124,8 @@ if ($cancel)
}
else
{
- header("Location: ".DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]));
- exit;
+ dol_print_error('', 'Cancel on photo_resize with a not supported value of modulepart='.$modulepart);
+ exit;
}
}
@@ -122,8 +145,8 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
}
else
{
- header("Location: ".DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]));
- exit;
+ dol_print_error('', 'Cancel on photo_resize with a not supported value of modulepart='.$modulepart);
+ exit;
}
}
else
@@ -151,8 +174,8 @@ if ($action == 'confirm_crop')
}
else
{
- header("Location: ".DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]));
- exit;
+ dol_print_error('', 'Cancel on photo_resize with a not supported value of modulepart='.$modulepart);
+ exit;
}
}
else
@@ -197,6 +220,7 @@ print $langs->trans("NewHeight").': ';
print '';
print '';
+print '';
print '';
print ' ';
print '';
@@ -232,7 +256,7 @@ if (! empty($conf->use_javascript_ajax))
print $langs->trans("DefineNewAreaToPick").'... ';
print '
';
print ' ';
- print '  ';
+ print '  ';
print ' ';
print ' ';
print ' |