2002-12-12 22:37:44 +01:00
< ? PHP
2003-02-03 12:56:05 +01:00
/* Copyright ( C ) 2002 - 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2002-12-12 22:37:44 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*
* $Id $
* $Source $
*/
require ( " ./pre.inc.php3 " );
llxHeader ();
$db = new Db ();
2003-02-03 12:56:05 +01:00
function do_upload ( $socid ) {
2002-12-12 22:37:44 +01:00
global $uploadfile , $uploadfile_size ;
global $local_file , $error_msg ;
if ( $uploadfile == " none " )
{
$error_msg = " You did not specify a file for uploading. " ;
return ;
}
if ( $uploadfile_size > 2000000 )
{
$error_msg = " Sorry, your file is too large. " ;
return ;
}
2003-02-03 12:56:05 +01:00
$soc_dir = SOCIETE_DOCUMENT_DIR . " / " . $socid ;
2002-12-12 22:37:44 +01:00
2003-02-03 12:56:05 +01:00
if ( ! is_dir ( $soc_dir ))
2002-12-12 22:37:44 +01:00
{
2003-02-03 12:56:05 +01:00
mkdir ( $soc_dir );
}
$upload_dir = " /tmp " ;
$local_file = SOCIETE_DOCUMENT_DIR . " / " . $socid . " / " ;
move_uploaded_file ( $userfile , $local_file );
2002-12-12 22:37:44 +01:00
2003-02-03 12:56:05 +01:00
print $HTTP_POST_FILES [ 'uploadfile' ][ 'name' ];
2002-12-12 22:37:44 +01:00
}
if ( $error_msg )
{
echo " <B> $error_msg </B><BR><BR> " ;
}
if ( $sendit )
{
2003-02-03 12:56:05 +01:00
do_upload ( $socid );
2002-12-12 22:37:44 +01:00
}
/*
*
* Mode fiche
*
*
*/
2003-02-03 12:56:05 +01:00
if ( $socid > 0 )
{
2002-12-12 22:37:44 +01:00
$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 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 );
2003-02-03 12:56:05 +01:00
if ( $result )
{
$objsoc = $db -> fetch_object ( 0 );
$dac = strftime ( " %Y-%m-%d %H:%M " , time ());
if ( $errmesg )
{
print " <b> $errmesg </b><br> " ;
}
/*
*
*/
print " <table width= \" 100% \" border= \" 0 \" cellspacing= \" 1 \" > \n " ;
print " <tr><td><div class= \" titre \" >Fiche client : $objsoc->nom </div></td> " ;
print " <td align= \" center \" ><a href= \" index.php3?socidp= $objsoc->idp &action=add_bookmark \" >[Bookmark]</a></td> " ;
print " <td align= \" center \" ><a href= \" projet/fiche.php3?socidp= $objsoc->idp &action=create \" >[Projet]</a></td> " ;
print " <td align= \" center \" ><a href= \" addpropal.php3?socidp= $objsoc->idp &action=create \" >[Propal]</a></td> " ;
print " <td><a href= \" socnote.php3?socid= $objsoc->idp\ " > Notes </ a ></ td > " ;
print " <td align= \" center \" >[<a href= \" ../soc.php3?socid= $objsoc->idp &action=edit \" >Editer</a>]</td> " ;
print " </tr></table> " ;
/*
*
*
*/
print " <table width= \" 100% \" border=0><tr> \n " ;
print " <td valign= \" top \" > " ;
print " <table cellspacing= \" 0 \" border= \" 1 \" width= \" 100% \" > " ;
print " <tr><td>Type</td><td> $objsoc->typent </td><td>Effectif</td><td> $objsoc->effectif </td></tr> " ;
print " <tr><td>Tel</td><td> $objsoc->tel </td><td>fax</td><td> $objsoc->fax </td></tr> " ;
print " <tr><td>Ville</td><td colspan= \" 3 \" > " . nl2br ( $objsoc -> address ) . " <br> $objsoc->cp $objsoc->ville </td></tr> " ;
print " <tr><td>siren</td><td><a href= \" http://www.societe.com/cgi-bin/recherche?rncs= $objsoc->siren\ " > $objsoc -> siren </ a >& nbsp ; </ td > " ;
print " <td>prefix</td><td> " ;
if ( $objsoc -> prefix_comm ) {
print $objsoc -> prefix_comm ;
} else {
print " [<a href= \" $PHP_SELF ?socid= $objsoc->idp &action=attribute_prefix \" >Attribuer</a>] " ;
}
print " </td></tr> " ;
print " <tr><td>Site</td><td colspan= \" 3 \" ><a href= \" http:// $objsoc->url\ " > $objsoc -> url </ a >& nbsp ; </ td ></ tr > " ;
print " </table> " ;
/*
*
*/
print " </td> \n " ;
print " </table> " ;
echo '<FORM NAME="userfile" ACTION="docsoc.php?socid=' . $socid . '" ENCTYPE="multipart/form-data" METHOD="POST">' ;
print '<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="2000000">' ;
print '<input type="file" name="userfile" size="40" maxlength="80">' ;
print '<BR><BR>' ;
print '<INPUT TYPE="SUBMIT" VALUE="Upload File!" NAME="sendit">' ;
print '<INPUT TYPE="SUBMIT" VALUE="Cancel" NAME="cancelit"><BR>' ;
print '</FORM>' ;
2002-12-12 22:37:44 +01:00
2003-02-03 12:56:05 +01:00
}
else
{
print $db -> error () . " <br> " . $sql ;
}
}
else
{
2002-12-12 22:37:44 +01:00
print " Erreur " ;
}
$db -> close ();
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>