diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index e500c5e8804..bd68b50b445 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -27,6 +27,7 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/member.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
@@ -77,7 +78,16 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = '
'.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
@@ -101,9 +111,10 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Suppression fichier
if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
- $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $langs->load("other");
+ $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 0d0f373ab7f..da83962fcd9 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -147,7 +147,8 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
$result = dol_delete_file($pathtodelete,1);
if ($result >= 0)
{
- $message = ''.$langs->trans("FileWasRemoved",$filetodelete).'
';
+ $langs->load("other");
+ $message = ''.$langs->trans("FileWasRemoved",$filetodelete).'
';
//print_r($_FILES);
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index aeb71f91b80..448ba78d158 100755
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -31,6 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/cactioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/actioncomm.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
@@ -67,8 +68,6 @@ if (! $sortfield) $sortfield="name";
*/
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
// Creation repertoire si n'existe pas
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
@@ -77,7 +76,16 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index cbc075247e1..204d17c2cb6 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -28,6 +28,7 @@ require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load('compta');
@@ -77,7 +78,16 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
@@ -104,12 +114,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
if ($object->fetch($id))
{
- $object->fetch_thirdparty();
+ $langs->load("other");
+ $object->fetch_thirdparty();
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,$object);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
}
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 322b32c5094..f45e0b407d8 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -27,6 +27,7 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
@@ -80,7 +81,16 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
@@ -107,12 +117,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
if ($object->fetch($id))
{
- $object->fetch_thirdparty();
+ $langs->load("other");
+ $object->fetch_thirdparty();
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,$object);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
}
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 27f7a09e0d6..000daceaae3 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -472,11 +472,11 @@ else if ($action == 'setconditions' && $user->rights->commande->creer)
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0)
- {
+ {
dol_print_error($db,$object->error);
}
else
- {
+ {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
@@ -492,7 +492,7 @@ else if ($action == 'setconditions' && $user->rights->commande->creer)
$ret=$object->fetch($id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
}
- }
+ }
}
else if ($action == 'setremisepercent' && $user->rights->commande->creer)
@@ -1024,10 +1024,11 @@ else if ($action == 'remove_file')
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+ $langs->load("other");
$upload_dir = $conf->commande->dir_output;
- $file = $upload_dir . '/' . $_GET['file'];
+ $file = $upload_dir . '/' . GETPOST('file');
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
}
}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index a3f2e8564af..0ae1c0fd74e 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -29,6 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT.'/core/class/discount.class.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/invoice.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load('propal');
@@ -82,7 +83,16 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
@@ -109,12 +119,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
if ($object->fetch($id))
{
+ $langs->load("other");
$object->fetch_thirdparty();
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,$object);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
}
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index 3261fab405a..82962f224eb 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -73,8 +73,6 @@ $modulepart='tax';
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if (dol_mkdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
@@ -82,11 +80,10 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
{
- // Create small thumbs for company (Ratio is near 16/9)
+ // Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
-
- // Create mini thumbs for company (Ratio is near 16/9)
+ // Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
}
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index cb270c042d8..ea04ce4e33f 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -29,6 +29,7 @@ require ("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/contract.lib.php");
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load("other");
@@ -69,13 +70,20 @@ $modulepart='contract';
*/
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if (dol_mkdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
$mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 34ecea9488b..2cc056c008f 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -504,9 +504,11 @@ class FormFile
if ($delallowed)
{
- $out.= '';
+ //$out.= ''.img_delete().' | ';
}
diff --git a/htdocs/document.php b/htdocs/document.php
index 6c8c7c59c7f..91a4c8c714e 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -483,7 +483,7 @@ if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
exit;
}
-
+/*
if ($action == 'remove_file') // Remove a file
{
clearstatcache();
@@ -508,7 +508,7 @@ if ($action == 'remove_file') // Remove a file
return;
}
else // Open and return file
-{
+{*/
clearstatcache();
$filename = basename($original_file);
@@ -540,6 +540,6 @@ else // Open and return file
//flush();
readfile($original_file_osencoded);
-}
+//}
?>
diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php
index e75a0903a28..55db3ddb284 100644
--- a/htdocs/ecm/docmine.php
+++ b/htdocs/ecm/docmine.php
@@ -73,8 +73,6 @@ $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
// Upload file
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if (dol_mkdir($upload_dir) >= 0)
{
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
@@ -110,12 +108,13 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Remove file
if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
{
- $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
- $result=dol_delete_file($file);
+ $langs->load("other");
+ $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $result=dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
- $result=$ecmdir->changeNbOfFiles('-');
+ $result=$ecmdir->changeNbOfFiles('-');
}
// Remove dir
diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php
index a6c17e2b45e..c07a4d799a7 100644
--- a/htdocs/ecm/docother.php
+++ b/htdocs/ecm/docother.php
@@ -43,8 +43,6 @@ $upload_dir = $conf->ecm->dir_output.'/'.$section;
// Envoie fichier
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if (dol_mkdir($upload_dir) >= 0)
{
$resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
@@ -80,9 +78,10 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Suppression fichier
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
{
- $file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
+ $langs->load("other");
+ $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index dff56695ace..4394ba60660 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -154,6 +154,7 @@ if ($action == 'confirm_deletefile')
{
if (GETPOST('confirm') == 'yes')
{
+ $langs->load("other");
$result=$ecmdir->fetch($section);
if (! $result > 0)
{
@@ -166,7 +167,7 @@ if ($action == 'confirm_deletefile')
$result=dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
$result=$ecmdir->changeNbOfFiles('-');
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index a25f5cfdea7..4a04ef2a564 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -27,6 +27,7 @@
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/fourn.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php";
@@ -74,8 +75,6 @@ if ($commande->fetch($_GET['id'],$_GET['ref']) < 0)
// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
$upload_dir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($commande->ref);
if (dol_mkdir($upload_dir) >= 0)
@@ -83,6 +82,15 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
$mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
@@ -107,10 +115,11 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Delete
if ($action=='delete')
{
+ $langs->load("other");
$upload_dir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($commande->ref);
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 5902fabe52b..8425ae5c0bd 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -579,10 +579,11 @@ else if ($action == 'remove_file' && $user->rights->fournisseur->commande->creer
if ($object->fetch($id))
{
+ $langs->load("other");
$upload_dir = $conf->fournisseur->commande->dir_output . "/";
- $file = $upload_dir . '/' . $_GET['file'];
+ $file = $upload_dir . '/' . GETPOST('file');
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
}
}
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 30b33678e9f..5a0e20cf31b 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -78,6 +78,15 @@ if ($_POST['sendit'] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
$mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
@@ -108,12 +117,13 @@ if ($action=='delete')
$facture = new FactureFournisseur($db);
if ($facture->fetch($facid))
{
+ $langs->load("other");
$ref=dol_sanitizeFileName($facture->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($facture->id,2).$ref;
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
- $mesg = ''.$langs->trans('FileWasRemoved').'
';
+ $mesg = ''.$langs->trans('FileWasRemoved',GETPOST('urlfile')).'
';
}
}
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 04fcd1e35ef..9cd107ac126 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -414,7 +414,7 @@ elseif ($action == 'update_line')
$pu=$_POST['puttc'];
$price_base_type='TTC';
}
-
+
if ($_POST['idprod'])
{
$prod = new Product($db);
@@ -426,12 +426,12 @@ elseif ($action == 'update_line')
}
else
{
-
+
$label = $_POST['desc'];
$type = $_POST["type"]?$_POST["type"]:0;
}
-
+
$localtax1tx= get_localtax($_POST['tauxtva'], 1, $object->thirdparty);
$localtax2tx= get_localtax($_POST['tauxtva'], 2, $object->thirdparty);
@@ -823,9 +823,9 @@ elseif ($action == 'remove_file')
if ($object->fetch($id))
{
$upload_dir = $conf->fournisseur->facture->dir_output . "/";
- $file = $upload_dir . '/' . $_GET['file'];
+ $file = $upload_dir . '/' . GETPOST('file');
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
}
}
diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php
index c37014a5517..9849671f5d0 100644
--- a/htdocs/ftp/index.php
+++ b/htdocs/ftp/index.php
@@ -161,6 +161,8 @@ if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes'
if ($conn_id && $ok && ! $mesg)
{
+ $langs->load("other");
+
// Remote file
$filename=$file;
$remotefile=$section.(preg_match('@[\\\/]$@',$section)?'':'/').$file;
@@ -208,6 +210,8 @@ if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("De
{
if ($const["check"]) // Is checkbox checked
{
+ $langs->load("other");
+
// Remote file
$file=$const["file"];
$section=$const["section"];
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 4450c318467..e56b520ef7a 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -28,6 +28,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
require_once(DOL_DOCUMENT_ROOT."/imports/class/import.class.php");
require_once(DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/import.lib.php");
$langs->load("exports");
@@ -191,8 +192,6 @@ if ($action == 'add_import_model')
if ($step == 3 && $datatoimport)
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
dol_mkdir($conf->import->dir_temp);
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index ee557fb9eb7..30ea8211eca 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -618,6 +618,9 @@ ByYear=By year
ByMonth=by month
ByDay=By day
BySalesRepresentative=By sales representative
+LinkedToSpecificUsers=Linked to a particular user contact
+DeleteAFile=Delete a file
+ConfirmDeleteAFile=Are you sure you want to delete file
# Week day
Monday=Monday
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index 7102d977e92..d298b043532 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -620,6 +620,9 @@ ByYear=Par année
ByMonth=Par mois
ByDay=Par jour
BySalesRepresentative=Par commerciaux
+LinkedToSpecificUsers=Liés à un contact utilisateur particulier
+DeleteAFile=Suppression de fichier
+ConfirmDeleteAFile=Confirmez-vous la suppression du fichier
# Week day
Monday=Lundi
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index b382b4b3cc7..051be50ebe2 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -29,6 +29,7 @@ require('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load("other");
@@ -73,14 +74,21 @@ $modulepart='produit';
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if (dol_mkdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index f66c62b1b5e..77602350540 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -26,6 +26,7 @@ require('../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load('projects');
@@ -70,8 +71,6 @@ if (! $sortfield) $sortfield="name";
// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($project->ref);
if (dol_mkdir($upload_dir) >= 0)
@@ -79,6 +78,15 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
$mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
@@ -103,10 +111,11 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Delete
if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->projet->supprimer)
{
+ $langs->load("other");
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($project->ref);
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index af96f49d8cb..9bf3c209200 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -43,11 +43,11 @@ if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $acti
$mine = GETPOST('mode')=='mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
-$project = new Project($db);
+$object = new Project($db);
if ($ref)
{
- $project->fetch(0,$ref);
- $id=$project->id;
+ $object->fetch(0,$ref);
+ $id=$object->id;
}
// Security check
@@ -89,31 +89,31 @@ if ($action == 'add' && $user->rights->projet->creer)
$db->begin();
- $project->ref = $_POST["ref"];
- $project->title = $_POST["title"];
- $project->socid = $_POST["socid"];
- $project->description = $_POST["description"];
- $project->public = $_POST["public"];
- $project->datec=dol_now();
- $project->dateo=dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
- $project->datee=dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
+ $object->ref = GETPOST('ref','alpha');
+ $object->title = GETPOST('title','alpha');
+ $object->socid = GETPOST('socid','int');
+ $object->description = GETPOST('description','alpha');
+ $object->public = GETPOST('public','alpha');
+ $object->datec=dol_now();
+ $object->date_start=dol_mktime(0,0,0,GETPOST('projectmonth','int'),GETPOST('projectday','int'),GETPOST('projectyear','int'));
+ $object->date_end=dol_mktime(0,0,0,GETPOST('projectendmonth','int'),GETPOST('projectendday','int'),GETPOST('projectendyear','int'));
- $result = $project->create($user);
+ $result = $object->create($user);
if ($result > 0)
{
// Add myself as project leader
- $result = $project->add_contact($user->id, 'PROJECTLEADER', 'internal');
+ $result = $object->add_contact($user->id, 'PROJECTLEADER', 'internal');
if ($result < 0)
{
$langs->load("errors");
- $mesg=''.$langs->trans($project->error).'
';
+ $mesg=''.$langs->trans($object->error).'
';
$error++;
}
}
else
{
$langs->load("errors");
- $mesg=''.$langs->trans($project->error).'
';
+ $mesg=''.$langs->trans($object->error).'
';
$error++;
}
@@ -121,7 +121,7 @@ if ($action == 'add' && $user->rights->projet->creer)
{
$db->commit();
- Header("Location:fiche.php?id=".$project->id);
+ Header("Location:fiche.php?id=".$object->id);
exit;
}
else
@@ -155,17 +155,19 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
}
if (! $error)
{
- $project->fetch($id);
+ $object->fetch($id);
- $project->ref = $_POST["ref"];
- $project->title = $_POST["title"];
- $project->socid = $_POST["socid"];
- $project->description = $_POST["description"];
- $project->public = $_POST["public"];
- $project->date_start = empty($_POST["project"])?'':dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
- $project->date_end = empty($_POST["projectend"])?'':dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
+ $old_start_date = $object->date_start;
- $result=$project->update($user);
+ $object->ref = GETPOST('ref','alpha');
+ $object->title = GETPOST('title','alpha');
+ $object->socid = GETPOST('socid','int');
+ $object->description = GETPOST('description','alpha');
+ $object->public = GETPOST('public','alpha');
+ $object->date_start = empty($_POST["project"])?'':dol_mktime(0,0,0,GETPOST('projectmonth'),GETPOST('projectday'),GETPOST('projectyear'));
+ $object->date_end = empty($_POST["projectend"])?'':dol_mktime(0,0,0,GETPOST('projectendmonth'),GETPOST('projectendday'),GETPOST('projectendyear'));
+
+ $result=$object->update($user);
$id=$project->id; // On retourne sur la fiche projet
}
@@ -178,10 +180,10 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
// Build doc
if ($action == 'builddoc' && $user->rights->projet->creer)
{
- $project->fetch($id);
+ $object->fetch($id);
if (GETPOST('model'))
{
- $project->setDocModel($user, GETPOST('model'));
+ $object->setDocModel($user, GETPOST('model'));
}
$outputlangs = $langs;
@@ -190,7 +192,7 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang(GETPOST('lang_id'));
}
- $result=project_pdf_create($db, $project, $project->modelpdf, $outputlangs);
+ $result=project_pdf_create($db, $object, $object->modelpdf, $outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
@@ -198,46 +200,61 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
}
else
{
- Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$project->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
+ Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc'));
exit;
}
}
+// Delete file in doc form
+if ($action == 'remove_file' && $user->rights->projet->creer)
+{
+ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+
+ if ($object->fetch($id))
+ {
+ $langs->load("other");
+ $upload_dir = $conf->projet->dir_output . "/";
+ $file = $upload_dir . '/' . GETPOST('file');
+ dol_delete_file($file);
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('file')).'
';
+ }
+}
+
if ($action == 'confirm_validate' && GETPOST('confirm') == 'yes')
{
- $project->fetch($id);
+ $object->fetch($id);
- $result = $project->setValid($user);
+ $result = $object->setValid($user);
if ($result <= 0)
{
- $mesg=''.$project->error.'
';
+ $mesg=''.$object->error.'
';
}
}
if ($action == 'confirm_close' && GETPOST('confirm') == 'yes')
{
- $project->fetch($id);
- $result = $project->setClose($user);
+ $object->fetch($id);
+ $result = $object->setClose($user);
if ($result <= 0)
{
- $mesg=''.$project->error.'
';
+ $mesg=''.$object->error.'
';
}
}
if ($action == 'confirm_reopen' && GETPOST('confirm') == 'yes')
{
- $project->fetch($id);
- $result = $project->setValid($user);
+ $object->fetch($id);
+ $result = $object->setValid($user);
if ($result <= 0)
{
- $mesg=''.$project->error.'
';
+ $mesg=''.$object->error.'
';
}
}
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->projet->supprimer)
{
- $project->fetch($id);
- $result=$project->delete($user);
+ $object->fetch($id);
+ $result=$object->delete($user);
if ($result > 0)
{
Header("Location: index.php");
@@ -245,7 +262,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights-
}
else
{
- dol_syslog($project->error,LOG_DEBUG);
+ dol_syslog($object->error,LOG_DEBUG);
$mesg=''.$langs->trans("CantRemoveProject").'
';
}
}
@@ -280,15 +297,13 @@ if ($action == 'create' && $user->rights->projet->creer)
print '';
- $project = new Project($db);
-
$defaultref='';
$obj = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
if (! empty($conf->global->PROJECT_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php"))
{
require_once(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php");
$modProject = new $obj;
- $defaultref = $modProject->getNextValue($soc,$project);
+ $defaultref = $modProject->getNextValue($soc,$object);
}
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
@@ -309,7 +324,7 @@ if ($action == 'create' && $user->rights->projet->creer)
// Public
print '| '.$langs->trans("Visibility").' | ';
$array=array(0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject"));
- print $form->selectarray('public',$array,$project->public);
+ print $form->selectarray('public',$array,$object->public);
print ' |
';
// Date start
@@ -350,37 +365,36 @@ else
dol_htmloutput_mesg($mesg);
- $project = new Project($db);
- $project->fetch($id,$ref);
+ $object->fetch($id,$ref);
- if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
+ if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id);
// To verify role of users
- $userAccess = $project->restrictedProjectArea($user,'read');
- $userWrite = $project->restrictedProjectArea($user,'write');
- $userDelete = $project->restrictedProjectArea($user,'delete');
+ $userAccess = $object->restrictedProjectArea($user,'read');
+ $userWrite = $object->restrictedProjectArea($user,'write');
+ $userDelete = $object->restrictedProjectArea($user,'delete');
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
- $head=project_prepare_head($project);
- dol_fiche_head($head, 'project', $langs->trans("Project"),0,($project->public?'projectpub':'project'));
+ $head=project_prepare_head($object);
+ dol_fiche_head($head, 'project', $langs->trans("Project"),0,($object->public?'projectpub':'project'));
// Confirmation validation
if ($action == 'validate')
{
- $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$project->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1);
if ($ret == 'html') print '
';
}
// Confirmation close
if ($action == 'close')
{
- $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("CloseAProject"),$langs->trans("ConfirmCloseAProject"),"confirm_close",'','',1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CloseAProject"),$langs->trans("ConfirmCloseAProject"),"confirm_close",'','',1);
if ($ret == 'html') print '
';
}
// Confirmation reopen
if ($action == 'reopen')
{
- $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("ReOpenAProject"),$langs->trans("ConfirmReOpenAProject"),"confirm_reopen",'','',1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ReOpenAProject"),$langs->trans("ConfirmReOpenAProject"),"confirm_reopen",'','',1);
if ($ret == 'html') print '
';
}
// Confirmation delete
@@ -388,14 +402,13 @@ else
{
$text=$langs->trans("ConfirmDeleteAProject");
$task=new Task($db);
- $taskarray=$task->getTasksArray(0,0,$project->id,0,0);
+ $taskarray=$task->getTasksArray(0,0,$object->id,0,0);
$nboftask=count($taskarray);
if ($nboftask) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks",$nboftask);
- $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$project->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1);
+ $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1);
if ($ret == 'html') print '
';
}
-
if ($action == 'edit' && $userWrite > 0)
{
print '
';
@@ -462,43 +475,43 @@ else
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
- $projectsListId = $project->getProjectsAuthorizedForUser($user,$mine,0);
- $project->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")";
+ $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0);
+ $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
- print $form->showrefnav($project,'ref','',1,'ref','ref');
+ print $form->showrefnav($object,'ref','',1,'ref','ref');
print '';
// Label
- print '| '.$langs->trans("Label").' | '.$project->title.' |
';
+ print '| '.$langs->trans("Label").' | '.$object->title.' |
';
// Third party
print '| '.$langs->trans("Company").' | ';
- if ($project->societe->id > 0) print $project->societe->getNomUrl(1);
+ if ($object->societe->id > 0) print $object->societe->getNomUrl(1);
else print' ';
print ' |
';
// Visibility
print '| '.$langs->trans("Visibility").' | ';
- if ($project->public) print $langs->trans('SharedProject');
+ if ($object->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject');
print ' |
';
// Statut
- print '| '.$langs->trans("Status").' | '.$project->getLibStatut(4).' |
';
+ print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4).' |
';
// Date start
print '| '.$langs->trans("DateStart").' | ';
- print dol_print_date($project->date_start,'day');
+ print dol_print_date($object->date_start,'day');
print ' |
';
// Date end
print '| '.$langs->trans("DateEnd").' | ';
- print dol_print_date($project->date_end,'day');
+ print dol_print_date($object->date_end,'day');
print ' |
';
// Description
print ''.$langs->trans("Description").' | ';
- print nl2br($project->description);
+ print nl2br($object->description);
print ' | ';
print '';
@@ -518,7 +531,7 @@ else
{
if ($userWrite > 0)
{
- print ''.$langs->trans("Valid").'';
+ print ''.$langs->trans("Valid").'';
}
else
{
@@ -527,11 +540,11 @@ else
}
// Modify
- if ($project->statut != 2 && $user->rights->projet->creer)
+ if ($object->statut != 2 && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
- print ''.$langs->trans("Modify").'';
+ print ''.$langs->trans("Modify").'';
}
else
{
@@ -540,11 +553,11 @@ else
}
// Close
- if ($project->statut == 1 && $user->rights->projet->creer)
+ if ($object->statut == 1 && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
- print ''.$langs->trans("Close").'';
+ print ''.$langs->trans("Close").'';
}
else
{
@@ -553,11 +566,11 @@ else
}
// Reopen
- if ($project->statut == 2 && $user->rights->projet->creer)
+ if ($object->statut == 2 && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
- print ''.$langs->trans("ReOpen").'';
+ print ''.$langs->trans("ReOpen").'';
}
else
{
@@ -570,7 +583,7 @@ else
{
if ($userDelete > 0)
{
- print ''.$langs->trans("Delete").'';
+ print ''.$langs->trans("Delete").'';
}
else
{
@@ -591,22 +604,22 @@ else
/*
* Documents generes
*/
- $filename=dol_sanitizeFileName($project->ref);
- $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($project->ref);
- $urlsource=$_SERVER["PHP_SELF"]."?id=".$project->id;
+ $filename=dol_sanitizeFileName($object->ref);
+ $filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
+ $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=($user->rights->projet->lire && $userAccess > 0);
$delallowed=($user->rights->projet->creer && $userWrite > 0);
$var=true;
- $somethingshown=$formfile->show_documents('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$project->modelpdf);
+ $somethingshown=$formfile->show_documents('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
print '';
// List of actions on element
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php');
$formactions=new FormActions($db);
- $somethingshown=$formactions->showactions($project,'project',$socid);
+ $somethingshown=$formactions->showactions($object,'project',$socid);
print ' | ';
}
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 137205d3c45..28818c96161 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -28,6 +28,7 @@ require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
@@ -74,14 +75,21 @@ $projectstatic = new Project($db);
// Envoi fichier
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
- require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
-
if (dol_mkdir($upload_dir) >= 0)
{
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- $mesg = ''.$langs->trans("FileTransferComplete").'
';
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
+ $mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
{
@@ -105,9 +113,10 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
// Delete
if ($action=='delete')
{
- $file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $langs->load("other");
+ $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
// Retreive First Task ID of Project if withprojet is on to allow project prev next to work
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index 55a94a10e24..a5e55ed4fe9 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -64,7 +64,7 @@ $object = new Societe($db);
if ($id > 0 || ! empty($ref))
{
$result = $object->fetch($id, $ref);
-
+
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ;
$courrier_dir = $conf->societe->multidir_output[$object->entity] . "/courrier/" . get_exdir($object->id);
}
@@ -74,6 +74,8 @@ if ($id > 0 || ! empty($ref))
* Actions
*/
+// TODO Use an include to mutualize this code for action sendit and confirm_deletefile
+
// Post file
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
@@ -84,16 +86,15 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
- if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
- {
- // Create small thumbs for company (Ratio is near 16/9)
- // Used on logon for example
- $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
-
- // Create mini thumbs for company (Ratio is near 16/9)
- // Used on menu or for setup page for example
- $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
- }
+ if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
+ {
+ // Create small thumbs for image (Ratio is near 16/9)
+ // Used on logon for example
+ $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
+ // Create mini thumbs for image (Ratio is near 16/9)
+ // Used on menu or for setup page for example
+ $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
+ }
$mesg = ''.$langs->trans("FileTransferComplete").'
';
}
else
@@ -121,9 +122,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
if ($object->id)
{
- $file = $upload_dir . "/" . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
+ $file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,$object);
- $mesg = ''.$langs->trans("FileWasRemoved").'
';
+ $mesg = ''.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'
';
}
}
@@ -144,12 +145,12 @@ if ($object->id)
*/
if ($conf->notification->enabled) $langs->load("mails");
$head = societe_prepare_head($object);
-
+
$form=new Form($db);
-
+
dol_fiche_head($head, 'document', $langs->trans("ThirdParty"),0,'company');
-
-
+
+
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
@@ -157,22 +158,22 @@ if ($object->id)
{
$totalsize+=$file['size'];
}
-
-
+
+
print '';
-
+
// Ref
print '| '.$langs->trans("ThirdPartyName").' | ';
print '';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print ' |
';
-
+
// Prefix
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '| '.$langs->trans('Prefix').' | '.$object->prefix_comm.' |
';
}
-
+
if ($object->client)
{
print '| ';
@@ -181,7 +182,7 @@ if ($object->id)
if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')';
print ' |
';
}
-
+
if ($object->fournisseur)
{
print '| ';
@@ -190,19 +191,19 @@ if ($object->id)
if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')';
print ' |
';
}
-
+
// Nbre fichiers
print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' |
';
-
+
//Total taille
print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' |
';
-
+
print '
';
-
+
print '';
-
+
dol_htmloutput_mesg($mesg,$mesgs);
-
+
/*
* Confirmation suppression fichier
*/
@@ -211,16 +212,16 @@ if ($object->id)
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '
';
}
-
+
$formfile=new FormFile($db);
-
+
// Show upload form
$formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id,'',0,0,$user->rights->societe->creer,50,$object);
-
+
// List of document
$param='&socid='.$object->id;
$formfile->list_of_documents($filearray,$object,'societe',$param);
-
+
print "
";
}
else