diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 3b28f6a746b..75ee1b0c721 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -96,23 +96,18 @@ llxHeader(); if ($_GET["id"] > 0) { - if ( $error_msg ) - { - echo '
'.$error_msg.'

'; - } - $act = new ActionComm($db); - $act->fetch($_GET["id"]); - $res=$act->societe->fetch($act->societe->id); - $res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé. - $res=$act->contact->fetch($act->contact->id); + $act->fetch($_GET["id"]); + $res=$act->societe->fetch($act->societe->id); + $res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé. + $res=$act->contact->fetch($act->contact->id); $h=0; $head[$h][0] = DOL_URL_ROOT.'/comm/action/fiche.php?id='.$_GET["id"]; - $head[$h][1] = $langs->trans("CardAction"); - $hselected=$h; - $h++; + $head[$h][1] = $langs->trans("CardAction"); + $hselected=$h; + $h++; $head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$_GET["id"]; $head[$h][1] = $langs->trans('Documents'); @@ -125,131 +120,119 @@ if ($_GET["id"] > 0) dolibarr_fiche_head($head, $hselected, $langs->trans("Action")); - // Affichage fiche action en mode visu - print ''; + // Ref + print ''; - // Type - print ''; + // Type + print ''; - // Libelle - print ''; + // Libelle + print ''; - // Societe - contact - print ''; - print ''; - print ''; - - // Construit liste des fichiers - clearstatcache(); - - $totalsize=0; - $filearray=array(); - - if (is_dir($upload_dir)) - { - $errorlevel=error_reporting(); - error_reporting(0); - $handle=opendir($upload_dir); - error_reporting($errorlevel); - if ($handle) - { - $i=0; - while (($file = readdir($handle))!==false) - { - if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') - { - $filearray[$i]=$file; - $totalsize+=filesize($upload_dir."/".$file); - $i++; - } - } - closedir($handle); - } - else - { - print '
'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'
'; - } - } - - print ''; - print ''; - print '
'.$langs->trans("Ref").''.$act->id.'
'.$langs->trans("Ref").''.$act->id.'
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Title").''.$act->label.'
'.$langs->trans("Title").''.$act->label.'
'.$langs->trans("Company").''.$act->societe->getNomUrl(1).''.$langs->trans("Contact").''; - if ($act->contact->id > 0) - { - print $act->contact->getNomUrl(1); - } - else - { - print $langs->trans("None"); - } - - print '
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - - print ''; - - - // Affiche formulaire upload - if ($conf->upload) - { - print_titre($langs->trans('AttachANewFile')); - - print '
'; - - print ''; - print '"; - print "
'; - - print ''; - print ''; - print '   '; - print ''; - - print "
"; - - print '
'; - print '
'; - } - - $errorlevel=error_reporting(); - error_reporting(0); - $handle=opendir($upload_dir); - error_reporting($errorlevel); - - print ''; - - if ($handle) + // Societe - contact + print ''; + print ''; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $var=true; - while (($file = readdir($handle))!==false) - { - if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') - { - $var=!$var; - print ''; - print '\n"; - print ''; - print ''; - print '\n"; - } - } - closedir($handle); + print $act->contact->getNomUrl(1); } + else + { + print $langs->trans("None"); + } + + print ''; + + // Construit liste des fichiers + clearstatcache(); + + $totalsize=0; + $filearray=array(); + + if (is_dir($upload_dir)) + { + $errorlevel=error_reporting(); + error_reporting(0); + $handle=opendir($upload_dir); + error_reporting($errorlevel); + if ($handle) + { + $i=0; + while (($file = readdir($handle))!==false) + { + if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') + { + $filearray[$i]=$file; + $totalsize+=filesize($upload_dir."/".$file); + $i++; + } + } + closedir($handle); + } + else + { + print '
'.$langs->trans("ErrorCanNotReadDir",$upload_dir).'
'; + } + } + + print ''; + print ''; print '
'.$langs->trans("Company").''.$act->societe->getNomUrl(1).''.$langs->trans("Contact").''; + if ($act->contact->id > 0) { - print '
'.$langs->trans('Document').''.$langs->trans('Size').''.$langs->trans('Date').' 
'; - echo ''.$file.''; - print "'.filesize($upload_dir.'/'.$file). ' bytes'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).''; - print ''.img_delete($langs->trans('Delete')).''; - print "
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - print ''; + print ''; + + if ($mesg) { print $mesg."
"; } + + // Affiche formulaire upload + $html=new Form($db); + $html->form_attach_new_file('document.php?id='.$act->id); + + // Affiche liste des documents existant + print_titre($langs->trans("AttachedFiles")); + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if (is_dir($upload_dir)) + { + $errorlevel=error_reporting(); + $handle=opendir($upload_dir); + if ($handle) + { + $var=true; + while (($file = readdir($handle))!==false) + { + if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') + { + $var=!$var; + print ''; + print '\n"; + print ''; + print ''; + print '\n"; + } + } + closedir($handle); + } + else + { + print '
'.$langs->trans('ErrorCantOpenDir').' '.$upload_dir.'
'; + } + } + print '
'.$langs->trans('Document').''.$langs->trans('Size').''.$langs->trans('Date').' 
'; + echo ''.$file.''; + print "'.filesize($upload_dir.'/'.$file). ' bytes'.strftime('%d %b %Y %H:%M:%S',filemtime($upload_dir.'/'.$file)).''; + print ''.img_delete($langs->trans('Delete')).''; + print "
'; } else {