diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index ea06d58d4e5..64e0b733f69 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -104,143 +104,144 @@ llxHeader(); if ($socid > 0) { - $societe = new Societe($db); - if ($societe->fetch($socid)) - { - /* - * Affichage onglets - */ - $head = societe_prepare_head($societe); - - dolibarr_fiche_head($head, 'document', $societe->nom); - - // Construit liste des fichiers - clearstatcache(); - - $totalsize=0; - $filearray=array(); - - $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 ''; - - // Ref - print ''; + $societe = new Societe($db); + if ($societe->fetch($socid)) + { + /* + * Affichage onglets + */ + $head = societe_prepare_head($societe); + + dolibarr_fiche_head($head, 'document', $societe->nom); + + // Construit liste des fichiers + clearstatcache(); + + $totalsize=0; + $filearray=array(); + + $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 '
'.$langs->trans("Name").''.$societe->nom.'
'; + + // Ref + print ''; - // Prefix - print ''; - - // Nbre fichiers - print ''; - - //Total taille - print ''; - - print '
'.$langs->trans("Name").''.$societe->nom.'
'.$langs->trans('Prefix').''.$societe->prefix_comm.'
'.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - - print ''; - - if ($mesg) { print "$mesg
"; } - - // Affiche formulaire upload - $html=new Form($db); - $html->form_attach_new_file('docsoc.php?socid='.$socid,$langs->trans("AddPhoto"),0); - - // Affiche liste des documents existant - print_titre($langs->trans("AttachedFiles")); + // Prefix + print ''.$langs->trans('Prefix').''.$societe->prefix_comm.''; + + // Nbre fichiers + print ''.$langs->trans("NbOfAttachedFiles").''.sizeof($filearray).''; + + //Total taille + print ''.$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('docsoc.php?socid='.$socid); + + // Affiche liste des documents existant + print_titre($langs->trans("AttachedFiles")); - print ''; - print ''; + print '
'.$langs->trans("Document").''.$langs->trans("Size").''.$langs->trans("Date").' 
'; + print ''; - $var=true; - foreach($filearray as $key => $file) - { - if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') - { - $var=!$var; - print "\n"; - print ''; - print ''; - print '\n"; - } - } - print "
'.$langs->trans("Document").''.$langs->trans("Size").''.$langs->trans("Date").' 
"; - echo ''.$file.''; - print "'.filesize($upload_dir."/".$file). ' '.$langs->trans("bytes").''.dolibarr_print_date(filemtime($upload_dir."/".$file),"%d %b %Y %H:%M:%S").''; - echo ''.img_delete().''; - print "


"; - // Courriers - // Les courriers sont des documents speciaux generes par des scripts - // Voir Rodo - $filearray=array(); - $errorlevel=error_reporting(); - error_reporting(0); - $handle=opendir($courrier_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; - $i++; - } - } - closedir($handle); - } + $var=true; + foreach($filearray as $key => $file) + { + if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') + { + $var=!$var; + print ""; + echo ''.$file.''; + print "\n"; + print ''.filesize($upload_dir."/".$file). ' '.$langs->trans("bytes").''; + print ''.dolibarr_print_date(filemtime($upload_dir."/".$file),"%d %b %Y %H:%M:%S").''; + print ''; + echo ''.img_delete().''; + print "\n"; + } + } + print "

"; - print ''; - print ''; + // Courriers + // Les courriers sont des documents speciaux generes par des scripts + // Voir Rodo + $filearray=array(); + $errorlevel=error_reporting(); + error_reporting(0); + $handle=opendir($courrier_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; + $i++; + } + } + closedir($handle); + } - $var=true; - foreach($filearray as $key => $file) - { - if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') - { - $var=!$var; - print "\n"; + print '
'.$langs->trans("Courriers").''.$langs->trans("Size").''.$langs->trans("Date").'
"; - $loc = "courrier/".get_exdir($socid); - echo ''.$file.''; - print "
'; + print ''; - print ''; - print ''; - print "\n"; - } - } - print "
'.$langs->trans("Courriers").''.$langs->trans("Size").''.$langs->trans("Date").'
'.filesize($courrier_dir."/".$file). ' '.$langs->trans("bytes").''.dolibarr_print_date(filemtime($courrier_dir."/".$file),"%d %b %Y %H:%M:%S").'
"; - } - else - { - dolibarr_print_error($db); - } + $var=true; + foreach($filearray as $key => $file) + { + if (!is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') + { + $var=!$var; + print ""; + $loc = "courrier/".get_exdir($socid); + echo ''.$file.''; + print "\n"; + + print ''.filesize($courrier_dir."/".$file). ' '.$langs->trans("bytes").''; + print ''.dolibarr_print_date(filemtime($courrier_dir."/".$file),"%d %b %Y %H:%M:%S").''; + print "\n"; + } + } + print ""; + } + else + { + dolibarr_print_error($db); + } } else { - dolibarr_print_error(); + dolibarr_print_error(); } $db->close();