Better error management and better error message for reporting upload or
error of images.
This commit is contained in:
parent
97f98d7e16
commit
90d47cffae
@ -117,7 +117,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
}
|
}
|
||||||
else dol_syslog($imgThumbMini);
|
else dol_syslog($imgThumbMini);
|
||||||
}
|
}
|
||||||
else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING);
|
else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING);
|
||||||
}
|
}
|
||||||
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
|
||||||
{
|
{
|
||||||
@ -133,9 +133,10 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorOnlyPngJpgSupported"),'errors');
|
$langs->load("errors");
|
||||||
|
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +159,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
|||||||
// Local taxes
|
// Local taxes
|
||||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
if($_POST["optionlocaltax1"]=="localtax1on")
|
if($_POST["optionlocaltax1"]=="localtax1on")
|
||||||
{
|
{
|
||||||
if(!isset($_REQUEST['lt1']))
|
if(!isset($_REQUEST['lt1']))
|
||||||
@ -226,13 +227,15 @@ if ($action == 'addthumb')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorImageFormatNotSupported"),'errors');
|
$langs->load("errors");
|
||||||
dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING);
|
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
|
||||||
|
dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors');
|
setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors');
|
||||||
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
|
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
|
||||||
}
|
}
|
||||||
@ -601,7 +604,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
|||||||
$formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
|
$formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
|
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
|
||||||
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
|
||||||
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
|
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
|
||||||
@ -1003,7 +1006,7 @@ else
|
|||||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
|
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
|
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
|
||||||
}
|
}
|
||||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
|
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
|
||||||
{
|
{
|
||||||
@ -1016,7 +1019,7 @@ else
|
|||||||
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
|
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
|
||||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
@ -1054,7 +1057,7 @@ else
|
|||||||
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
|
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
|
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
|
||||||
}
|
}
|
||||||
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
|
||||||
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
|
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
|
||||||
{
|
{
|
||||||
@ -1068,7 +1071,7 @@ else
|
|||||||
{
|
{
|
||||||
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|||||||
@ -37,7 +37,7 @@ ErrorSupplierCodeRequired=Supplier code required
|
|||||||
ErrorSupplierCodeAlreadyUsed=Supplier code already used
|
ErrorSupplierCodeAlreadyUsed=Supplier code already used
|
||||||
ErrorBadParameters=Bad parameters
|
ErrorBadParameters=Bad parameters
|
||||||
ErrorBadValueForParameter=Wrong value '%s' for parameter incorrect '%s'
|
ErrorBadValueForParameter=Wrong value '%s' for parameter incorrect '%s'
|
||||||
ErrorBadImageFormat=Image file has not a supported format
|
ErrorBadImageFormat=Image file has not a supported format (Your PHP does not support functions to convert images of this format)
|
||||||
ErrorBadDateFormat=Value '%s' has wrong date format
|
ErrorBadDateFormat=Value '%s' has wrong date format
|
||||||
ErrorWrongDate=Date is not correct!
|
ErrorWrongDate=Date is not correct!
|
||||||
ErrorFailedToWriteInDir=Failed to write in directory %s
|
ErrorFailedToWriteInDir=Failed to write in directory %s
|
||||||
|
|||||||
@ -58,12 +58,12 @@ ErrorCantLoadUserFromDolibarrDatabase=Failed to find user <b>%s</b> in Dolibarr
|
|||||||
ErrorNoVATRateDefinedForSellerCountry=Error, no vat rates defined for country '%s'.
|
ErrorNoVATRateDefinedForSellerCountry=Error, no vat rates defined for country '%s'.
|
||||||
ErrorNoSocialContributionForSellerCountry=Error, no social contribution type defined for country '%s'.
|
ErrorNoSocialContributionForSellerCountry=Error, no social contribution type defined for country '%s'.
|
||||||
ErrorFailedToSaveFile=Error, failed to save file.
|
ErrorFailedToSaveFile=Error, failed to save file.
|
||||||
ErrorOnlyPngJpgSupported=Error, only .png and .jpg image format file are supported.
|
|
||||||
ErrorImageFormatNotSupported=Your PHP does not support functions to convert images of this format.
|
|
||||||
SetDate=Set date
|
SetDate=Set date
|
||||||
SelectDate=Select a date
|
SelectDate=Select a date
|
||||||
SeeAlso=See also %s
|
SeeAlso=See also %s
|
||||||
BackgroundColorByDefault=Default background color
|
BackgroundColorByDefault=Default background color
|
||||||
|
FileNotUploaded=The file was not uploaded
|
||||||
|
FileUploaded=The file was successfully uploaded
|
||||||
FileWasNotUploaded=A file is selected for attachment but was not yet uploaded. Click on "Attach file" for this.
|
FileWasNotUploaded=A file is selected for attachment but was not yet uploaded. Click on "Attach file" for this.
|
||||||
NbOfEntries=Nb of entries
|
NbOfEntries=Nb of entries
|
||||||
GoToWikiHelpPage=Read online help (need Internet access)
|
GoToWikiHelpPage=Read online help (need Internet access)
|
||||||
|
|||||||
@ -55,8 +55,6 @@ NoOpenedPropals=No opened commercial proposals
|
|||||||
NoOtherOpenedPropals=No other opened commercial proposals
|
NoOtherOpenedPropals=No other opened commercial proposals
|
||||||
RefProposal=Commercial proposal ref
|
RefProposal=Commercial proposal ref
|
||||||
SendPropalByMail=Send commercial proposal by mail
|
SendPropalByMail=Send commercial proposal by mail
|
||||||
FileNotUploaded=The file was not uploaded
|
|
||||||
FileUploaded=The file was successfully uploaded
|
|
||||||
AssociatedDocuments=Documents associated with the proposal:
|
AssociatedDocuments=Documents associated with the proposal:
|
||||||
ErrorCantOpenDir=Can't open directory
|
ErrorCantOpenDir=Can't open directory
|
||||||
DatePropal=Date of proposal
|
DatePropal=Date of proposal
|
||||||
|
|||||||
@ -46,6 +46,8 @@ class Product extends CommonObject
|
|||||||
protected $isnolinkedbythird = 1; // No field fk_soc
|
protected $isnolinkedbythird = 1; // No field fk_soc
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
|
||||||
|
var $regeximgext='\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff';
|
||||||
|
|
||||||
//! Identifiant unique
|
//! Identifiant unique
|
||||||
var $id ;
|
var $id ;
|
||||||
//! Ref
|
//! Ref
|
||||||
@ -1479,7 +1481,7 @@ class Product extends CommonObject
|
|||||||
$this->date_modification = $obj->tms;
|
$this->date_modification = $obj->tms;
|
||||||
$this->import_key = $obj->import_key;
|
$this->import_key = $obj->import_key;
|
||||||
$this->entity = $obj->entity;
|
$this->entity = $obj->entity;
|
||||||
|
|
||||||
$this->ref_ext = $obj->ref_ext;
|
$this->ref_ext = $obj->ref_ext;
|
||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
@ -3068,18 +3070,19 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deplace fichier uploade sous le nom $files dans le repertoire sdir
|
* Move an uploaded file described into $file array into target directory $sdir.
|
||||||
*
|
*
|
||||||
* @param string $sdir Repertoire destination finale
|
* @param string $sdir Target directory
|
||||||
* @param string $file Nom du fichier uploade
|
* @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
|
||||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 by defaut)
|
||||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 by defaut)
|
||||||
* @return void
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
|
$result = 0;
|
||||||
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/photos";
|
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/photos";
|
||||||
|
|
||||||
dol_mkdir($dir);
|
dol_mkdir($dir);
|
||||||
@ -3098,6 +3101,9 @@ class Product extends CommonObject
|
|||||||
$this->add_thumb($originImage,$maxWidth,$maxHeight);
|
$this->add_thumb($originImage,$maxWidth,$maxHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_numeric($result) && $result > 0) return 1;
|
||||||
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3192,7 +3198,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||||
|
|
||||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file))
|
if (dol_is_file($dir.$file) && preg_match('/('.$this->regeximgext.')$/i', $dir.$file))
|
||||||
{
|
{
|
||||||
$nbphoto++;
|
$nbphoto++;
|
||||||
$photo = $file;
|
$photo = $file;
|
||||||
@ -3227,11 +3233,11 @@ class Product extends CommonObject
|
|||||||
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||||
if ($photo_vignette && $imgarray['height'] > $maxHeight) {
|
if ($photo_vignette && $imgarray['height'] > $maxHeight) {
|
||||||
$return.= '<!-- Show thumb -->';
|
$return.= '<!-- Show thumb -->';
|
||||||
$return.= '<img class="photo" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return.= '<!-- Show original file -->';
|
$return.= '<!-- Show original file -->';
|
||||||
$return.= '<img class="photo" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
$return.= '</a>'."\n";
|
$return.= '</a>'."\n";
|
||||||
@ -3241,7 +3247,7 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
$return.= '<br>';
|
$return.= '<br>';
|
||||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||||
if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
|
if ($photo_vignette && preg_match('/('.$this->regeximgext.')$/i', $photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
|
||||||
{
|
{
|
||||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||||
}
|
}
|
||||||
@ -3266,7 +3272,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($size == 0) { // Format origine
|
if ($size == 0) { // Format origine
|
||||||
$return.= '<img class="photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'">';
|
$return.= '<img class="photo photowithmargin" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'">';
|
||||||
|
|
||||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||||
if ($showaction)
|
if ($showaction)
|
||||||
@ -3334,14 +3340,14 @@ class Product extends CommonObject
|
|||||||
while (($file = readdir($handle)) != false)
|
while (($file = readdir($handle)) != false)
|
||||||
{
|
{
|
||||||
if (! utf8_check($file)) $file=utf8_encode($file); // readdir returns ISO
|
if (! utf8_check($file)) $file=utf8_encode($file); // readdir returns ISO
|
||||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file))
|
if (dol_is_file($dir.$file) && preg_match('/('.$this->regeximgext.')$/i', $dir.$file))
|
||||||
{
|
{
|
||||||
$nbphoto++;
|
$nbphoto++;
|
||||||
|
|
||||||
// On determine nom du fichier vignette
|
// On determine nom du fichier vignette
|
||||||
$photo=$file;
|
$photo=$file;
|
||||||
$photo_vignette='';
|
$photo_vignette='';
|
||||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs))
|
if (preg_match('/('.$this->regeximgext.')$/i', $photo, $regs))
|
||||||
{
|
{
|
||||||
$photo_vignette=preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0];
|
$photo_vignette=preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0];
|
||||||
}
|
}
|
||||||
@ -3385,7 +3391,7 @@ class Product extends CommonObject
|
|||||||
dol_delete_file($file);
|
dol_delete_file($file);
|
||||||
|
|
||||||
// Si elle existe, on efface la vignette
|
// Si elle existe, on efface la vignette
|
||||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
|
if (preg_match('/('.$this->regeximgext.')$/i',$filename,$regs))
|
||||||
{
|
{
|
||||||
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0];
|
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0];
|
||||||
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
|
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
|
|
||||||
@ -59,7 +60,20 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
{
|
{
|
||||||
if ($object->id) $result = $object->add_photo($dir, $_FILES['userfile']);
|
if ($object->id)
|
||||||
|
{
|
||||||
|
if (image_format_supported($_FILES['userfile']['name']) >= 1)
|
||||||
|
{
|
||||||
|
$result = $object->add_photo($dir, $_FILES['userfile']);
|
||||||
|
if ($result > 0) setEventMessage($langs->trans("FileUploaded"));
|
||||||
|
else setEventMessage($langs->trans("FileNotUploaded"), 'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessage($langs->trans("ErrorBadImageFormat"), 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
|
|||||||
@ -2120,9 +2120,11 @@ div.dolgraph div.legend, div.dolgraph div.legend div { background-color: rgba(25
|
|||||||
div.dolgraph div.legend table tbody tr { height: auto; }
|
div.dolgraph div.legend table tbody tr { height: auto; }
|
||||||
|
|
||||||
.photo {
|
.photo {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
/* filter:alpha(opacity=55); */
|
}
|
||||||
/* opacity:.55; */
|
.photowithmargin {
|
||||||
|
margin-bottom: 2px;
|
||||||
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo_setup
|
.logo_setup
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user