diff --git a/htdocs/comm/docsoc.php b/htdocs/comm/docsoc.php index d01e7ac92d6..0afab49b8bc 100644 --- a/htdocs/comm/docsoc.php +++ b/htdocs/comm/docsoc.php @@ -22,31 +22,37 @@ require("./pre.inc.php3"); llxHeader(); +$mesg = ""; + $upload_dir = SOCIETE_OUTPUTDIR . "/" . $socid ; if (! is_dir($upload_dir)) { umask(0); - mkdir($upload_dir, 0755); + if (! mkdir($upload_dir, 0755)) + { + print "Impossible de créer $upload_dir"; + } } -function do_upload ($socid) +if ( $sendit ) { - global $upload_dir; - global $local_file, $error_msg; - - if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'])) + if (is_dir($upload_dir)) { - print "Le fichier est valide, et a été téléchargé + + if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'])) + { + $mesg = "Le fichier est valide, et a été téléchargé avec succès.\n"; - //print_r($_FILES); + //print_r($_FILES); + } + else + { + $mesg = "Le fichier n'a pas été téléchargé"; + // print_r($_FILES); + } + } - else - { - echo "Le fichier n'a pas été téléchargé"; - // print_r($_FILES); - } - } if ( $error_msg ) @@ -57,14 +63,9 @@ if ($action=='delete') { $file = $upload_dir . "/" . urldecode($urlfile); dol_delete_file($file); + $mesg = "Le fichier a été supprimé"; } -if ( $sendit ) -{ - do_upload ($socid); -} - - /* * * Mode fiche @@ -73,70 +74,22 @@ if ( $sendit ) */ if ($socid > 0) { - $societe = new Societe($db, $socid); - - $sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc, s.tel, s.fax, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note, t.libelle as typent, e.libelle as effectif, s.siren, s.prefix_comm, s.services,s.parent, s.description FROM llx_societe as s, c_stcomm as st, c_typent as t, c_effectif as e "; - $sql .= " WHERE s.fk_stcomm=st.id AND s.fk_typent = t.id AND s.fk_effectif = e.id"; - - - $result = $db->query($sql); - - if ($result) + $societe = new Societe($db); + if ($societe->fetch($socid)) { - $objsoc = $db->fetch_object(0); - - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) - { - print "$errmesg
"; - } - /* * */ print "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; + print ""; + print ""; + print ""; print "
Documents associés à l'entreprise : $objsoc->nom
idp\">Commercialidp\">Comptaidp\">Notes[idp&action=edit\">Editer]
Documents associés à l'entreprise : $societe->nom
id\">Commercialid\">Compta
"; /* * * */ - - - print "\n"; - print "\n"; - - print "
"; - print ""; - - print ""; - print ""; - print ""; - - print ""; - print ""; - - print "
Type $objsoc->typentEffectif$objsoc->effectif
Tel $objsoc->tel fax$objsoc->fax 
Ville".nl2br($objsoc->address)."
$objsoc->cp $objsoc->ville
sirensiren\">$objsoc->siren prefix"; - if ($objsoc->prefix_comm) - { - print $objsoc->prefix_comm; - } - else - { - print "[idp&action=attribute_prefix\">Attribuer]"; - } - - print "
"; - - /* - * - */ - print "
"; echo '
'; print ''; @@ -146,6 +99,8 @@ if ($socid > 0) print '
'; print '
'; + print $mesg; + clearstatcache(); $handle=opendir($upload_dir);