Fix: delete of documents is done by page of element, not by the view
wrapper. Conflicts: htdocs/langs/en_US/main.lang htdocs/langs/fr_FR/main.lang htdocs/projet/fiche.php
This commit is contained in:
parent
caadf396e2
commit
514babeab1
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -147,7 +147,8 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
|
||||
$result = dol_delete_file($pathtodelete,1);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$message = '<div class="ok">'.$langs->trans("FileWasRemoved",$filetodelete).'</div>';
|
||||
$langs->load("other");
|
||||
$message = '<div class="ok">'.$langs->trans("FileWasRemoved",$filetodelete).'</div>';
|
||||
//print_r($_FILES);
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -504,9 +504,11 @@ class FormFile
|
||||
|
||||
if ($delallowed)
|
||||
{
|
||||
$out.= '<td align="right"><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '&urlsource='.urlencode($urlsource);
|
||||
$out.= '<td align="right">';
|
||||
//$out.= '<a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= '<a href="'.$urlsource.'&action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath);
|
||||
$out.= ($param?'&'.$param:'');
|
||||
$out.= '&urlsource='.urlencode($urlsource);
|
||||
$out.= '">'.img_delete().'</a></td>';
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
//}
|
||||
|
||||
?>
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
|
||||
$result=$ecmdir->changeNbOfFiles('-');
|
||||
$result=$ecmdir->changeNbOfFiles('-');
|
||||
}
|
||||
|
||||
// Remove dir
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
|
||||
$result=$ecmdir->changeNbOfFiles('-');
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans('FileWasRemoved').'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans('FileWasRemoved',GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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"];
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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='<div class="error">'.$langs->trans($project->error).'</div>';
|
||||
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg='<div class="error">'.$langs->trans($project->error).'</div>';
|
||||
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
||||
$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 = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
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='<div class="error">'.$project->error.'</div>';
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
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='<div class="error">'.$project->error.'</div>';
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
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='<div class="error">'.$project->error.'</div>';
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
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='<div class="error">'.$langs->trans("CantRemoveProject").'</div>';
|
||||
}
|
||||
}
|
||||
@ -280,15 +297,13 @@ if ($action == 'create' && $user->rights->projet->creer)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$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 '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
$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 '</td></tr>';
|
||||
|
||||
// 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 '<br>';
|
||||
}
|
||||
// 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 '<br>';
|
||||
}
|
||||
// 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 '<br>';
|
||||
}
|
||||
// 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.='<br>'.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 '<br>';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'edit' && $userWrite > 0)
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
@ -407,11 +420,11 @@ else
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input size="12" name="ref" value="'.$project->ref.'"></td></tr>';
|
||||
print '<td><input size="12" name="ref" value="'.$object->ref.'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td>';
|
||||
print '<td><input size="30" name="title" value="'.$project->title.'"></td></tr>';
|
||||
print '<td><input size="30" name="title" value="'.$object->title.'"></td></tr>';
|
||||
|
||||
// Customer
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
@ -423,11 +436,11 @@ else
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
$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 '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
@ -436,13 +449,13 @@ else
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print $form->select_date($project->date_end?$project->date_end:-1,'projectend');
|
||||
print $form->select_date($object->date_end?$object->date_end:-1,'projectend');
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||
print '<td>';
|
||||
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$project->description.'</textarea>';
|
||||
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$object->description.'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -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 '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$project->title.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
if ($project->societe->id > 0) print $project->societe->getNomUrl(1);
|
||||
if ($object->societe->id > 0) print $object->societe->getNomUrl(1);
|
||||
else print' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Visibility
|
||||
print '<tr><td>'.$langs->trans("Visibility").'</td><td>';
|
||||
if ($project->public) print $langs->trans('SharedProject');
|
||||
if ($object->public) print $langs->trans('SharedProject');
|
||||
else print $langs->trans('PrivateProject');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
print dol_print_date($project->date_start,'day');
|
||||
print dol_print_date($object->date_start,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print dol_print_date($project->date_end,'day');
|
||||
print dol_print_date($object->date_end,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
print nl2br($project->description);
|
||||
print nl2br($object->description);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -518,7 +531,7 @@ else
|
||||
{
|
||||
if ($userWrite > 0)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$project->id.'&action=validate">'.$langs->trans("Valid").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$object->id.'&action=validate">'.$langs->trans("Valid").'</a>';
|
||||
}
|
||||
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 '<a class="butAction" href="fiche.php?id='.$project->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
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 '<a class="butAction" href="fiche.php?id='.$project->id.'&action=close">'.$langs->trans("Close").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$object->id.'&action=close">'.$langs->trans("Close").'</a>';
|
||||
}
|
||||
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 '<a class="butAction" href="fiche.php?id='.$project->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -570,7 +583,7 @@ else
|
||||
{
|
||||
if ($userDelete > 0)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$project->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
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 '</td><td valign="top" width="50%">';
|
||||
|
||||
// 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 '</td></tr></table>';
|
||||
}
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
|
||||
// Retreive First Task ID of Project if withprojet is on to allow project prev next to work
|
||||
|
||||
@ -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 = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
}
|
||||
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 = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 '<table class="border"width="100%">';
|
||||
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Prefix
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
@ -181,7 +182,7 @@ if ($object->id)
|
||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($object->fournisseur)
|
||||
{
|
||||
print '<tr><td>';
|
||||
@ -190,19 +191,19 @@ if ($object->id)
|
||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Nbre fichiers
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
|
||||
|
||||
//Total taille
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
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 '<br>';
|
||||
}
|
||||
|
||||
|
||||
$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 "<br><br>";
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user