diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 81a288e7dce..41b74079948 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1018,7 +1018,7 @@ class FormFile global $form; $disablecrop=1; - if (in_array($modulepart, array('societe','product','produit','service','expensereport','holiday','member','project','ticket','user'))) $disablecrop=0; + if (in_array($modulepart, array('expensereport','holiday','member','project','product','produit','service','societe','tax','ticket','user'))) $disablecrop=0; // Define relative path used to store the file if (empty($relativepath)) diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index f4f178031de..b7e774bcd4d 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -83,6 +83,12 @@ elseif ($modulepart == 'societe') if (! $user->rights->societe->lire) accessforbidden(); $accessallowed=1; } +elseif ($modulepart == 'tax') +{ + $result=restrictedArea($user, 'tax', $id, 'chargesociales','charges'); + if (! $user->rights->tax->charges->lire) accessforbidden(); + $accessallowed=1; +} elseif ($modulepart == 'ticket') { $result=restrictedArea($user,'ticket',$id,'ticket'); @@ -177,6 +183,17 @@ elseif ($modulepart == 'expensereport') $dir=$conf->expensereport->dir_output; // By default } } +elseif ($modulepart == 'tax') +{ + require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; + $object = new ChargeSociales($db); + if ($id > 0) + { + $result = $object->fetch($id); + if ($result <= 0) dol_print_error($db,'Failed to load object'); + $dir=$conf->tax->dir_output; // By default + } +} elseif ($modulepart == 'ticket') { require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; @@ -200,7 +217,8 @@ if (empty($backtourl)) else if (in_array($modulepart, array('member'))) $backtourl=DOL_URL_ROOT."/adherents/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"]); else if (in_array($modulepart, array('societe'))) $backtourl=DOL_URL_ROOT."/societe/document.php?id=".$id.'&file='.urldecode($_POST["file"]); - else if (in_array($modulepart, array('ticket'))) $backtourl=DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + else if (in_array($modulepart, array('tax'))) $backtourl=DOL_URL_ROOT."/compta/sociales/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + else if (in_array($modulepart, array('ticket'))) $backtourl=DOL_URL_ROOT."/ticket/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]); } @@ -226,6 +244,7 @@ if ($cancel) if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POST["sizex"]) != "") && (isset($_POST["sizey"]) != "")) { $fullpath=$dir."/".$original_file; + $result=dol_imageResizeOrCrop($fullpath,0,$_POST['sizex'],$_POST['sizey']); if ($result == $fullpath) @@ -294,6 +313,8 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS if ($action == 'confirm_crop') { $fullpath=$dir."/".$original_file; + + //var_dump($_POST['w'].'x'.$_POST['h'].'-'.$_POST['x'].'x'.$_POST['y']);exit; $result=dol_imageResizeOrCrop($fullpath,1,$_POST['w'],$_POST['h'],$_POST['x'],$_POST['y']); if ($result == $fullpath) @@ -419,9 +440,9 @@ if (! empty($conf->use_javascript_ajax)) // If image is too large, we use another scale. if (! empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth']/2))) { - $widthforcrop=round($_SESSION['dol_screenwidth']/2); + $ratioforcrop=2; + $widthforcrop=round($_SESSION['dol_screenwidth'] / $ratioforcrop); $refsizeforcrop='screenwidth'; - $ratioforcrop=1; } print ''."\n"; @@ -448,7 +469,7 @@ if (! empty($conf->use_javascript_ajax)) - +