Browse Source

Initial release

Rodolphe Quiedeville 23 years ago
parent
commit
e2269d5bbf

+ 340 - 0
COPYING

@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

+ 76 - 0
htdocs/comm/actioncomm.class.php3

@@ -0,0 +1,76 @@
+<?PHP
+/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+class ActionComm {
+  var $id;
+  var $db;
+
+  var $date;
+  var $type;
+  var $user;
+  var $societe;
+  var $contact;
+  var $note;
+
+  Function ActionComm($db) {
+    $this->db = $db;
+  }
+  /*
+   *
+   *
+   *
+   */
+  Function add() {
+    $sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, fk_user_author, fk_contact, note) ";
+    $sql .= " VALUES ('$this->date',$this->type,$this->societe,$this->user,$this->contact,'$this->note')";
+
+    if ($this->db->query($sql) ) {
+
+    }
+  }
+  /*
+   *
+   *
+   *
+   */
+  Function fetch($db, $id) {
+
+    $sql = "SELECT libelle FROM c_actioncomm WHERE id=$id;";
+
+    if ($db->query($sql) ) {
+      if ($db->num_rows()) {
+	$obj = $db->fetch_object(0);
+
+	$this->id = $rowid;
+	$this->datep = $obj->dp;
+	$this->ref = $obj->ref;
+	$this->price = $obj->price;
+	
+	$db->free();
+      }
+    } else {
+      print $db->error();
+    }    
+  }
+}    
+?>
+    

+ 243 - 0
htdocs/comm/actioncomm.php3

@@ -0,0 +1,243 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+require("./pre.inc.php3");
+require("../lib/functions.inc.php3");
+require("../societe.class.php3");
+require("../contact.class.php3");
+require("cactioncomm.class.php3");
+require("actioncomm.class.php3");
+llxHeader();
+$db = new Db();
+if ($sortfield == "") {
+  $sortfield="a.datea";
+}
+if ($sortorder == "") {
+  $sortorder="DESC";
+}
+
+if ($page == -1) { $page = 0 ; }
+$limit = 26;
+$offset = $limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+print "<A href=\"$PHP_SELF?page=$pageprev&begin=$begin&stcomm=$stcomm\">< Prev</A>\n| ";
+print " <A href=\"$PHP_SELF?page=$pagenext&begin=$begin&stcomm=$stcomm\">Next ></A>\n";
+
+
+$bc1="bgcolor=\"#90c090\"";
+$bc2="bgcolor=\"#b0e0b0\"";
+/*
+ *
+ *
+ *
+ */
+if ($action=='add') {
+  $actioncomm = new ActionComm($db);
+  $actioncomm->date = $date;
+  $actioncomm->type = $actionid;
+  $actioncomm->contact = $contactid;
+  $actioncomm->user = $user->id;
+  $actioncomm->societe = $socid;
+  $actioncomm->note = $note;
+
+  $actioncomm->add();
+}
+/*
+ *
+ *
+ *
+ */
+if ($action=='create' && $actionid && $contactid) {
+  $caction = new CActioncomm();
+  $caction->fetch($db, $actionid);
+
+  $contact = new Contact($db);
+  $contact->fetch($contactid);
+
+  $societe = new Societe($db);
+  $societe->get_nom($socid);
+
+
+  print '<form action="actioncomm.php3" method="post">';
+  print '<input type="hidden" name="action" value="add">';
+  print '<input type="hidden" name="date" value="'.$db->idate(time()).'">';
+  print '<input type="hidden" name="actionid" value="'.$actionid.'">';
+  print '<input type="hidden" name="contactid" value="'.$contactid.'">';
+  print '<input type="hidden" name="socid" value="'.$socid.'">';
+
+  print '<table width="100%" border="1" cellspacing="0" cellpadding="3">';
+  print '<tr><td width="10%">Action</td><td colspan="3" bgcolor="#e0e0e0"><b>'.$caction->libelle.'</td></tr>';
+  print '<tr><td width="10%">Société</td><td width="40%"bgcolor="#e0e0e0"><b>'.$societe->nom.'</td>';
+  print '<td width="10%">Contact</td><td width="40%"bgcolor="#e0e0e0"><b>'.$contact->fullname.'</td></tr>';
+  print '<tr><td>Auteur</td><td>'.$user->fullname.'</td>';
+  print '<td>Date</td><td>'.strftime('%d %B %Y %H:%M',time()).'</td></tr>';
+  print '<tr><td valign="top">Commentaire</td><td colspan="3">';
+  print '<textarea cols="60" rows="6" name="note"></textarea></td></tr>';
+  print '<tr><td colspan="4" align="center"><input type="submit"></td></tr>';
+
+  print '</form></table>';
+  $limit = 10;
+  print '<p>Vos 10 dernières actions';
+}
+/*
+ *
+ *
+ *
+ */
+if ($id) {
+  print '<table width="100%" border="1" cellspacing="0" cellpadding="3">';
+  print '<tr><td width="10%">Action</td><td colspan="3" bgcolor="#e0e0e0"><b>'.$libelle.'</td></tr>';
+  print '<tr><td width="10%">Société</td><td width="40%"bgcolor="#e0e0e0"><b>'.$nom.'</td>';
+  print '<td width="10%">Contact</td><td width="40%"bgcolor="#e0e0e0"><b>'.$fullname.'</td></tr>';
+  print '<tr><td>Auteur</td><td>'.$fullname.'</td>';
+  print '<td>Date</td><td>'.strftime('%d %B %Y %H:%M',time()).'</td></tr>';
+  print '<tr><td valign="top">Commentaire</td><td colspan="3">';
+  print '<textarea cols="60" rows="6" name="note"></textarea></td></tr>';
+
+  print '</table>';
+  $limit = 10;
+  print '<p>Vos 10 dernières actions';
+}
+
+/*
+ *
+ *  Liste
+ *
+ */
+
+if ($socid) {
+
+  $sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, c.libelle, u.code, a.note, u.name, u.firstname ";
+  $sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u";
+$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
+ 
+ if ($type) {
+   $sql .= " AND c.id = $type";
+ }
+
+ $sql .= " ORDER BY $sortfield $sortorder ";
+
+ if ( $db->query($sql) ) {
+   $num = $db->num_rows();
+   $i = 0;
+   print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
+   print "<TR bgcolor=\"orange\">";
+   print '<TD>Date</TD>';
+   print '<TD>Societe</td>';
+   print "<TD>Note</TD>";
+   print "</TR>\n";
+   $var=True;
+   while ($i < $num) {
+     $obj = $db->fetch_object( $i);
+     if ($i == 0) {
+       print "<TR bgcolor=\"orange\">";
+       print '<TD>Auteur</TD>';
+       print "<TD width=\"30%\"><a href=\"index.php3?socid=$obj->socidp\">$obj->societe</A></TD>\n";
+       print "<TD>&nbsp;</TD>";
+       print "</TR>\n";
+     }
+     $var=!$var;
+     
+     if (!$var) {
+       $bc=$bc1;
+     } else {
+       $bc=$bc2;
+     }
+     print "<TR $bc>";
+     print "<TD>" .strftime("%d %b %Y %H:%M",$obj->da)."</TD>\n"; 
+
+     print "<TD width=\"30%\"><a href=\"index.php3?socid=$obj->socidp\">$obj->societe</A></TD>\n";
+     print '<TD align="left" valign="top" rowspan="2">'.nl2br($obj->note).'</TD>';
+     print "</TR>\n";
+
+     print "<TR $bc>";
+     print "<TD width=\"20%\">$obj->firstname $obj->name</TD>\n";
+     print '<TD width="30%"><a href="actioncomm.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
+     print "</TR>\n";
+
+     $i++;
+   }
+   print "</TABLE>";
+   $db->free();
+ }
+
+} else {
+
+
+$sql = "SELECT s.nom as societe, s.idp as socidp,a.id,".$db->pdate("a.datea")." as da, a.datea, c.libelle, u.code ";
+$sql .= " FROM actioncomm as a, c_actioncomm as c, societe as s, llx_user as u";
+$sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
+
+if ($type) {
+  $sql .= " AND c.id = $type";
+}
+
+$sql .= " ORDER BY $sortfield $sortorder ";
+$sql .= $db->plimit( $limit, $offset);
+
+
+if ( $db->query($sql) ) {
+  $num = $db->num_rows();
+  $i = 0;
+  print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
+  print "<TR bgcolor=\"orange\">";
+  print '<TD colspan="4">Date</TD>';
+  print '<TD><a href="'.$PHP_SELF.'?sortfield=lower(s.nom)&sortorder=ASC">Societe</a></td>';
+  print '<TD><a href="'.$PHP_SELF.'?sortfield=c.libelle">Action</a></TD>';
+  print "<TD>Auteur</TD>";
+  print "</TR>\n";
+  $var=True;
+  while ($i < $num) {
+    $obj = $db->fetch_object( $i);
+    
+    $var=!$var;
+    
+    if (!$var) {
+      $bc=$bc1;
+    } else {
+      $bc=$bc2;
+    }
+    print "<TR $bc>";
+    print "<TD>" .strftime("%d",$obj->da)."</TD>\n"; 
+    print "<TD>" .strftime("%b",$obj->da)."</TD>\n"; 
+    print "<TD>" .strftime("%Y",$obj->da)."</TD>\n"; 
+    print "<TD>" .strftime("%H:%M",$obj->da)."</TD>\n";
+    print "<TD width=\"50%\"><a href=\"index.php3?socid=$obj->socidp\">$obj->societe</A></TD>\n";
+    
+    print '<TD width="30%"><a href="actioncomm.php3?id='.$obj->id.'">'.$obj->libelle.'</a></td>';
+    print "<TD width=\"20%\">$obj->code</TD>\n";
+    print "<TD align=\"center\">$obj->stcomm</TD>\n";
+    print "</TR>\n";
+    $i++;
+  }
+  print "</TABLE>";
+  $db->free();
+}
+
+
+}
+
+$db->close();
+
+llxFooter();
+?>

+ 54 - 0
htdocs/comm/cactioncomm.class.php3

@@ -0,0 +1,54 @@
+<?PHP
+/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+class CActioncomm {
+  var $id;
+  var $libelle;
+
+  Function CActioncomm() {
+
+  }
+  /*
+   *
+   *
+   *
+   */
+  Function fetch($db, $id) {
+
+    $sql = "SELECT libelle FROM c_actioncomm WHERE id=$id;";
+
+    if ($db->query($sql) ) {
+      if ($db->num_rows()) {
+	$obj = $db->fetch_object(0);
+
+	$this->id = $id;
+	$this->libelle = $obj->libelle;
+	
+	$db->free();
+      }
+    } else {
+      print $db->error();
+    }    
+  }
+}    
+?>
+    

+ 233 - 0
htdocs/comm/facture.php3

@@ -0,0 +1,233 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+require("./pre.inc.php3");
+require("../lib/functions.inc.php3");
+llxHeader();
+$db = new Db();
+$author = $GLOBALS["REMOTE_USER"];
+$bc[0]="bgcolor=\"#90c090\"";
+$bc[1]="bgcolor=\"#b0e0b0\"";
+
+
+if ($action == 'add') {
+  $datefacture = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear)); 
+
+  $sql = "INSERT INTO llx_facture (facnumber, fk_soc, datec, datef, note, amount, remise, tva, total, author) ";
+  $sql .= " VALUES ('$facnumber', $socid, now(), $datefacture,'$note', $amount, $remise, $tva, $total, '$author');";
+  $result = $db->query($sql);
+
+  if ($result) {
+    $sql = "SELECT rowid, facnumber FROM llx_facture WHERE facnumber='$facnumber';";
+    $result = $db->query($sql);
+    if ($result) {
+      $objfac = $db->fetch_object( 0);
+      $facid = $objfac->rowid;
+      $facnumber = $objfac->facnumber;
+      $action = '';
+
+      $sql = "INSERT INTO llx_fa_pr (fk_facture,fk_propal) VALUES ($facid, $propalid);";
+      $result = $db->query($sql);
+
+
+      /*
+       *
+       * Génération du PDF
+       *
+       */
+
+      print "<hr><b>Génération du PDF</b><p>";
+
+      $command = "export DBI_DSN=\"".$GLOBALS["DBI"]."\" ";
+      $command .= " ; ../../scripts/facture-tex.pl --facture=$facid --pdf --gljroot=" . $GLOBALS["GLJ_ROOT"] ;
+
+      $output = system($command);
+      print "<p>command : $command<br>";
+
+
+
+
+    }
+  } else {
+    print "<p><b>Erreur : la facture n'a pas été créée, vérifier le numéro !</b>";
+    print "<p>Retour à la <a href=\"propal.php3?propalid=$propalid\">propal</a>";
+  }
+
+} elseif ($action == 'create') {
+
+  $sql = "SELECT s.nom, s.prefix_comm, s.idp, p.price, p.remise, p.tva, p.total, p.ref, ".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst, p.author";
+  $sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
+
+  $sql .= " AND p.rowid = $propalid";
+
+  if ( $db->query($sql) ) {
+    $num = $db->num_rows();
+    if ($num) {
+      $obj = $db->fetch_object( 0);
+
+      $numfa = "F-" . $obj->prefix_comm . "-" . strftime("%y%m%d", time());
+
+      print "Emettre une facture<p>";
+      print "<form action=\"$PHP_SELF\" method=\"post\">";
+      print "<input name=\"amount\" type=\"hidden\" value=\"".($obj->price - $obj->remise)."\">";
+      print "<input name=\"total\" type=\"hidden\" value=\"$obj->total\">";
+      print "<table cellspacing=0 border=1>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>Société :</td><td>$obj->nom</td>";
+      print "<td rowspan=7>Commentaires :<br>";
+      print "<textarea name=\"note\" wrap=\"soft\" cols=\"30\" rows=\"15\"></textarea></td></tr>";
+
+
+      print "<tr bgcolor=\"#e0e0e0\"><td>Propal :</td><td>$obj->ref</td></tr>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>Montant HT :</td><td align=\"right\">".price($obj->price - $obj->remise)."</td></tr>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>TVA :</td><td align=\"right\">".price($obj->tva)."</td></tr>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>Total TTC :</td><td align=\"right\">".price($obj->total)."</td></tr>";
+
+      print "<input type=\"hidden\" name=\"remise\" value=\"$obj->remise\">";
+      print "<input type=\"hidden\" name=\"tva\" value=\"$obj->tva\">";
+
+      print "<input type=\"hidden\" name=\"action\" value=\"add\">";
+      print "<input type=\"hidden\" name=\"propalid\" value=\"$propalid\">";
+      print "<input type=\"hidden\" name=\"socid\" value=\"$obj->idp\">";
+
+      $strmonth[1] = "Janvier";   $strmonth[2] = "F&eacute;vrier";   $strmonth[3] = "Mars";       $strmonth[4] = "Avril";  
+      $strmonth[5] = "Mai"; $strmonth[6] = "Juin"; $strmonth[7] = "Juillet";          $strmonth[8] = "Ao&ucirc;t"; 
+      $strmonth[9] = "Septembre"; $strmonth[10] = "Octobre";
+      $strmonth[11] = "Novembre"; $strmonth[12] = "D&eacute;cembre";
+
+      print "<tr><td>Date :</td><td>";
+      $cday = date("d", time());
+      print "<select name=\"pday\">";    
+      for ($day = 1 ; $day < $sday + 32 ; $day++) {
+	if ($day == $cday) {
+	  print "<option value=\"$day\" SELECTED>$day";
+	} else {
+	  print "<option value=\"$day\">$day";
+	}
+      }
+      print "</select>";
+      $cmonth = date("n", time());
+      print "<select name=\"pmonth\">";    
+      for ($month = 1 ; $month <= 12 ; $month++) {
+	if ($month == $cmonth) {
+	  print "<option value=\"$month\" SELECTED>" . $strmonth[$month];
+	} else {
+	  print "<option value=\"$month\">" . $strmonth[$month];
+	}
+      }
+      print "</select>";
+      
+      print "<select name=\"pyear\">";
+      $syear = date("Y", time() ) ;
+      print "<option value=\"".($syear-1)."\">".($syear-1);
+      print "<option value=\"$syear\" SELECTED>$syear";
+
+      for ($year = $syear +1 ; $year < $syear + 5 ; $year++) {
+	print "<option value=\"$year\">$year";
+      }
+      print "</select></td></tr>";
+      $author = $GLOBALS["REMOTE_USER"];
+      print "<input type=\"hidden\" name=\"author\" value=\"$author\">";
+
+      print "<tr><td>Auteur :</td><td>$author</td></tr>";
+      print "<tr><td>Numéro :</td><td> <input name=\"facnumber\" type=\"text\" value=\"$numfa\"></td></tr>";
+      print "<tr><td colspan=\"3\" align=\"center\"><input type=\"submit\" value=\"Enregistrer\"></td></tr>";
+      print "</form>";
+      print "</table>";
+
+    }
+  }
+
+
+  print "<p><table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
+  print "<tr bgcolor=\"orange\">";
+  print "<td>Societe</a></td><td>Num</td>";
+  print "<td align=\"right\">Date</td>";
+  print "<td align=\"right\">Montant</td>";
+  print "<td align=\"right\">Payé</td>";
+  print "</tr>\n";
+  
+  $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
+  $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp ORDER BY f.datec DESC ";
+        
+  if ( $db->query($sql) ) {
+    $num = $db->num_rows();
+    if ($num > 0) {
+      $i = 0; $var=True;
+      while ($i < $num) {
+	$objp = $db->fetch_object( $i);
+	$var=!$var;
+	print "<TR $bc[$var]>";
+	print "<TD><a href=\"../comm/index.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
+	print "<td><a href=\"facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
+	  
+	if ($objp->df > 0 ) {
+	  print "<TD align=\"right\">";
+	  print strftime("%d %B %Y",$objp->df)."</a></TD>\n";
+	} else {
+	  print "<TD align=\"right\"><b>!!!</b></TD>\n";
+	}
+	print "<TD align=\"right\">".price($objp->amount)."</TD>\n";
+	  
+	$yn[1] = "oui";
+	$yn[0] = "<b>non</b>";
+	
+	$total = $total + $objp->amount;	  
+	print "<TD align=\"right\">".$yn[$objp->paye]."</TD>\n";
+	print "</TR>\n";
+	$i++;
+      }
+      print "<tr><td></td><td>$i factures</td><td align=\"right\"><b>Total : ".francs($total)." FF</b></td>";
+      print "<td align=\"right\"><b>Total : ".price($total)."</b></td><td>$_MONNAIES HT</td></tr>";
+    }
+    $db->free();
+  } else {
+    print "<tr><td>".$db->error()."</td></tr>";
+  }
+  print "</TABLE>";  
+}
+
+if ($facid) {
+
+  $sql = "SELECT s.nom,s.idp, f.amount, f.facnumber, f.rowid";
+  $sql .= " FROM societe as s, llx_facture as f  WHERE f.fk_soc = s.idp";
+  $sql .= " AND f.rowid = $facid";
+
+  $result = $db->query($sql);
+  if ($result) {
+    $num = $db->num_rows();
+    if ($num) {
+      $obj = $db->fetch_object( 0);
+      print "Facture<p>";
+      print "<table cellspacing=0 border=1>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>Numero :</td><td><a href=\"../compta/facture.php3?facid=$obj->rowid\">$obj->facnumber</a></td></tr>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>Société :</td><td>$obj->nom</td></tr>";
+      print "<tr bgcolor=\"#e0e0e0\"><td>Montant :</td><td>$obj->amount</td></tr>";
+      print "</table>";
+    }
+  }
+}
+
+
+$db->close();
+
+llxFooter();
+?>

+ 913 - 0
htdocs/comm/index.php3

@@ -0,0 +1,913 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+require("./pre.inc.php3");
+require("../lib/functions.inc.php3");
+require("../lib/company.lib.php3");
+llxHeader();
+$db = new Db();
+if ($sortorder == "") {
+  $sortorder="ASC";
+}
+if ($sortfield == "") {
+  $sortfield="nom";
+}
+$bc[0]="bgcolor=\"#c0f0c0\"";
+$bc[1]="bgcolor=\"#b0e0b0\"";
+$bc2[0]="bgcolor=\"#c9f000\"";
+$bc2[1]="bgcolor=\"#b9e000\"";
+$active["1"] = "Offres en ligne";
+$active["-1"] = "Moderation";
+$active["-2"] = "Refusées";
+$active["0"] = "Rédaction";
+$active["-3"] = "Désactivées";
+$active["-4"] = "Supprimées";
+$cr["t"] = "Cab. Recrut.";
+$cr["f"] = "-";
+$cr[""] = "????";
+$cr["1"] = "Cab. Recrut.";
+$cr["0"] = "-";
+
+$yn["t"] = "oui";
+$yn["f"] = "non";
+$yn["1"] = "oui";
+$yn["0"] = "non";
+
+$deacmeth["b"] = "robots";
+$deacmeth["m"] = "manuelle";
+
+if ($action == 'attribute_prefix') {
+  $prefix_attrib = soc_attribute_prefix($db, $socid);
+}
+
+if ($action == 'cabrecrut') {
+  if ($selectvalue) {
+    $sql = "UPDATE societe SET cabrecrut='$selectvalue' WHERE idp=$socid";
+    $result = $db->query($sql);
+  }
+}
+if ($action == 'recontact') {
+  $dr = mktime(0, 0, 0, $remonth, $reday, $reyear);
+  $sql = "INSERT INTO llx_soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $GLOBALS["REMOTE_USER"]."')";
+  $result = $db->query($sql);
+}
+
+if ($action == 'note') {
+  $sql = "UPDATE societe SET note='$note' WHERE idp=$socid";
+  $result = $db->query($sql);
+}
+
+if ($action == 'stcomm') {
+  if ($stcommid <> 'null' && $stcommid <> $oldstcomm) {
+    $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) ";
+    $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $GLOBALS["REMOTE_USER"] . "')";
+    $result = @$db->query($sql);
+
+    if ($result) {
+      $sql = "UPDATE societe SET fk_stcomm=$stcommid WHERE idp=$socid";
+      $result = $db->query($sql);
+    } else {
+      $errmesg = "ERREUR DE DATE !";
+    }
+  }
+
+  if ($actioncommid) {
+    $sql = "INSERT INTO actioncomm (datea, fk_action, fk_soc, author) VALUES ('$dateaction',$actioncommid,$socid,'" . $GLOBALS["REMOTE_USER"] . "')";
+    $result = @$db->query($sql);
+
+    if (!$result) {
+      $errmesg = "ERREUR DE DATE !";
+    }
+  }
+}
+if ($page == -1) { $page = 0 ; }
+$limit = 26;
+$offset = $limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+print "<DIV align=\"center\">";
+
+print "<A href=\"$PHP_SELF?page=$pageprev&begin=$begin&stcomm=$stcomm&sortfield=$sortfield&sortorder=$sortorder&aclasser=$aclasser&coord=$coord\">&lt;- Prev</A>\n| ";
+print "<A href=\"$PHP_SELF?page=$pageprev&stcomm=$stcomm&sortfield=$sortfield&sortorder=$sortorder&aclasser=$aclasser&coord=$coord\">*</A>\n| ";
+for ($i = 65 ; $i < 91; $i++) {
+  print "<A href=\"$PHP_SELF?begin=" . chr($i) . "&stcomm=$stcomm\" class=\"T3\">";
+  
+  if ($begin == chr($i) ) {
+    print  "<b>-&gt;" . chr($i) . "&lt;-</b>" ; 
+  } else {
+    print  chr($i)  ; 
+  }
+  print "</A> | ";
+}
+print " <A href=\"$PHP_SELF?page=$pagenext&begin=$begin&stcomm=$stcomm&sortfield=$sortfield&sortorder=$sortorder&aclasser=$aclasser&coord=$coord\">Next -></A>\n";
+print "</DIV><P>";
+/*
+ * Recherche
+ *
+ *
+ */
+if ($mode == 'search') 
+{
+  if ($mode-search == 'soc')
+    {
+      $sql = "SELECT s.idp FROM societe as s, c_stcomm as st ";
+      $sql .= " WHERE s.fk_stcomm = st.id AND s.datea IS NOT NULL";
+
+      if ($socname) 
+	{
+	  $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'";
+	  $sortfield = "lower(s.nom)";
+	  $sortorder = "ASC";
+	}
+      
+ 
+      $result = $db->query($sql);
+      if ($result) 
+	{
+	  if ( $db->num_rows() == 1) 
+	    {
+	      $obj = $db->fetch_object(0);
+	      $socid = $obj->idp;
+	    }
+	  $db->free();
+	}
+    }
+  else 
+    {
+
+    }
+
+}
+
+
+
+/*
+ * Mode fiche
+ *
+ *
+ */  
+if ($socid > 0) {
+
+  $sql = "SELECT s.idp, s.nom, ".$db->pdate("s.datec")." as dc,".$db->pdate("s.datel")." as dl,".$db->pdate("s.datem")." as dm, ".$db->pdate("s.datea")." as da, s.intern, s.cjn, s.c_nom, s.c_prenom, s.c_tel, s.c_mail, s.tel, s.fax, s.fplus, s.cjn, s.viewed, st.libelle as stcomm, s.fk_stcomm, s.url,s.address,s.cp,s.ville, s.note,s.karma,s.off_acc, s.off_ref,s.view_res_coord, t.libelle as typent, s.cabrecrut, 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";
+
+  if ($to == 'next') {
+    $sql .= " AND s.idp > $socid ORDER BY idp ASC LIMIT 1";
+  } elseif ($to == 'prev') {
+    $sql .= " AND s.idp < $socid ORDER BY idp DESC LIMIT 1";
+  } else {
+    $sql .= " AND s.idp = $socid";
+  }
+
+  $result = $db->query($sql);
+
+  if ($result) {
+    $objsoc = $db->fetch_object(0);
+
+    $dac = strftime("%Y-%m-%d %H:%M", time());
+    if ($errmesg) {
+      print "<b>$errmesg</b><br>";
+    }
+    print "<form action=\"index.php3?socid=$objsoc->idp\" method=\"post\">";
+    print "<input type=\"hidden\" name=\"action\" value=\"stcomm\">";
+    print "<input type=\"hidden\" name=\"oldstcomm\" value=\"$objsoc->fk_stcomm\">";
+    
+    $sql = "SELECT st.id, st.libelle FROM c_stcomm as st ORDER BY id";
+    $result = $db->query($sql);
+    print "<select name=\"stcommid\">\n";
+    print "<option value=\"null\" SELECTED>\n";
+    if ($result) {
+      $num = $db->num_rows();
+      $i = 0 ;
+      while ($i < $num) {
+	$objse = $db->fetch_object( $i);
+	
+	print "<option value=\"$objse->id\"";
+	if ($objse->id == $objsoc->fk_stcomm) { print " SELECTED"; }
+	print ">$objse->libelle\n";
+	$i++;
+      }
+    }
+    print "</select>\n";
+    $sql = "SELECT st.id, st.libelle FROM c_actioncomm as st ORDER BY id";
+    $result = $db->query($sql);
+    print "<select name=\"actioncommid\">\n";
+    print "<option value=\"0\" SELECTED>\n";
+    if ($result) {
+      $num = $db->num_rows();
+      $i = 0 ;
+      while ($i < $num) {
+	$objse = $db->fetch_object($i);
+	
+	print "<option value=\"$objse->id\">$objse->libelle\n";
+	$i++;
+      }
+    }
+    print "</select>\n";
+
+    print "<input type=\"text\" name=\"dateaction\" size=\"16\" value=\"$dac\">";
+    print "<input type=\"submit\" value=\"Update\">";
+    print "</form>\n";
+    /*
+     *
+     */
+    print "<table width=\"100%\" border=\"0\" cellspacing=\"1\">\n";
+    /*
+     *
+     */
+    print "<tr><td><big>N° $objsoc->idp - $objsoc->nom - [$objsoc->stcomm]</big></td>";
+    print "<td bgcolor=\"#e0E0E0\" align=\"center\"><a href=\"bookmark.php3?socidp=$objsoc->idp&action=add\">[Bookmark]</a></td>";
+    print "<td bgcolor=\"#e0E0E0\" align=\"center\"><a href=\"projet/fiche.php3?socidp=$objsoc->idp&action=create\">[Projet]</a></td>";
+    print "<td bgcolor=\"#e0E0E0\" 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><a href=\"people.php3?socid=$objsoc->idp\">Contacts</a></td>";
+    print "<td><a href=\"../tech/soc/soc.php3?socid=$objsoc->idp\">Fiche Technique</a></td>";
+    print "<td bgcolor=\"#e0E0E0\" align=\"center\">[<a href=\"../soc.php3?socid=$objsoc->idp&action=edit\">Editer</a>]</td>";
+    print "</tr></table>";
+    if ($objsoc->parent > 0) {
+      print "<hr>Société rattaché au cabinet <a href=\"$PHP_SELF?socid=$objsoc->parent\">$objsoc->parent</a>";
+    }
+    print "<hr>";
+    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&nbsp;</td><td>fax</td><td>$objsoc->fax&nbsp;</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 "<tr><td>Contact </td><td colspan=\"3\"><b>$objsoc->c_nom $objsoc->c_prenom</b>&nbsp;</td></tr>";
+    print "<tr><td>tel</td><td><b>$objsoc->c_tel</b>&nbsp;</td><td colspan=\"2\">email : <b>$objsoc->c_mail</b>&nbsp;</td></tr>";
+    print "</table>";
+
+    /*
+     *
+     */
+    print "</td>\n";
+    print "<td valign=\"top\"><table border=0 width=\"100%\" cellspacing=0 bgcolor=#e0e0e0>";
+    if ($objsoc->dl > 0) {
+      $datel = strftime("%d %b %Y %H:%M", $objsoc->dl);
+    } else {
+      $datel = "Pas d'infos";
+    }
+    print "<tr><td>Dernière connexion</td><td align=center><b>$datel</b></td></tr>";
+    print "<tr><td>Créée le</td><td align=center><b>" . strftime("%d %b %Y %H:%M", $objsoc->dc) . "</b></td></tr>";
+    //print "<tr><td>Dernière modif le</td><td align=center><b>" . strftime("%d %b %Y %H:%M", $objsoc->dm) . "</b></td></tr>";
+    print "<tr><td>Fiche Entreprise</td><td align=center><b>".$yn[$objsoc->fplus]."</b></td></tr>" ;
+    print "<tr bgcolor=\"#d0d0d0\"><td>Coordonnees CV</td><td align=center><b>".$yn["$objsoc->view_res_coord"]."</b>&nbsp;</td></tr>" ;
+    print "<tr bgcolor=\"#d0d0d0\"><td><b>Contacts CV</b></td><td align=center><b>".$yn["$objsoc->services"]."</b>&nbsp;</td></tr>" ;
+
+    if ($objsoc->cabrecrut == 1) {
+      print "<tr bgcolor=\"white\"><td><b>Cab. Recrut.</b> : Oui</td>";
+    } elseif ($objsoc->cabrecrut == 0) {
+      print "<tr><td>Cab. Recrut. : Non</td>";
+    } else {
+      print "<tr><td>Cab. Recrut. : ???</td>";
+    }
+    print "<td><a href=\"$PHP_SELF?socid=$objsoc->idp&action=changevalue&type=cabrecrut\">changer</a></td></tr>";
+
+    print "<tr><td colspan=\"2\">";
+    //print "<hr noshade size=1></td></tr>";
+    //print "<tr><td>Cojonet</td><td align=center><b>".$yn["$objsoc->cjn"]."</b></td></tr>" ;
+    //print "<tr><td>Consult Fiche</td><td align=center><b>$objsoc->viewed</b></td></tr>";
+
+    print "<tr><td valign=\"top\">";
+    print "<hr noshade size=1>";
+
+    print "<table border=0 cellspacing=0>";
+    print "<tr><td><b>Karma</b></td><td>:</td><td align=center><b>$objsoc->karma</b></td></tr>";
+    print "<tr><td><b>Nb d'acceptation</b></td><td>:</td><td align=center><b>$objsoc->off_acc</b></td></tr>";
+    print "<tr><td><b>Nb de refus</b></td><td>:</td><td align=center><b>$objsoc->off_ref</b></td></tr>";
+
+    $sql = "SELECT count(idp) as cc, active FROM offre WHERE fk_soc = $objsoc->idp GROUP by active ORDER BY active DESC";
+    if ( $db->query($sql) ) {
+
+      $i = 0 ; $num = $db->num_rows();
+      while ($i < $num) {
+	$obj = $db->fetch_object( $i);
+	print "<tr><td>".$active["$obj->active"] . "</td><td>:</td><td>$obj->cc</tr>";
+	$i++;
+      }
+      $db->free();
+    } else {
+      print $db->error();
+    }
+    print "</table></td>";
+
+    print "<td valign=\"top\"><hr noshade size=1>";
+    print "<table cellspacing=0 border=0>";
+    print "<tr><td><b>CV consultés</b></td>";
+    $sql = "SELECT week1 + week2 + week3 + week4 as t, week1, week2, week3, week4 FROM soc_resviewed_byweek WHERE fk_soc = $objsoc->idp";
+    if ( $db->query($sql) ) {
+      $i = 0 ; $num = $db->num_rows();
+      while ($i < $num) {
+	$obj = $db->fetch_object( $i);
+	print "<td>: $obj->t ( $obj->week1 - $obj->week2 - $obj->week3 - $obj->week4 )</td></tr>";
+	$i++;
+      }
+      $db->free();
+    } else {
+      print $db->error();
+    }
+    print "</tr>";
+    print "<tr><td><b>Contacts</b></td>";
+    $sql = "SELECT week1 + week2 + week3 + week4 as t, week1, week2, week3, week4 FROM soc_rescontact_byweek WHERE fk_soc = $objsoc->idp";
+    if ( $db->query($sql) ) {
+      $i = 0 ; $num = $db->num_rows();
+      while ($i < $num) {
+	$obj = $db->fetch_object( $i);
+	print "<td>: $obj->t ( $obj->week1 - $obj->week2 - $obj->week3 - $obj->week4 )</td></tr>";
+	$i++;
+      }
+      $db->free();
+    } else {
+      print $db->error();
+    }
+
+    $sql = "SELECT count(idp) as cc FROM abo_soc WHERE fksoc = $objsoc->idp GROUP by active";
+    $result = $db->query($sql);
+    $i = 0 ; $num = $db->num_rows();
+    while ($i < $num) {
+      $obj = $db->fetch_object( $i);
+      print "<tr><td>Abonnements</td><td>: $obj->cc</td></tr>";
+      $i++;
+    }
+    $sql = "SELECT count(idp) as cc FROM socfollowresume WHERE fk_soc = $objsoc->idp";
+    if ( $db->query($sql) ) {
+      $i = 0 ; $num = $db->num_rows();
+      while ($i < $num) {
+	$obj = $db->fetch_object( $i);
+	print "<tr><td>Cand. suivis</td><td>: $obj->cc</td></tr>";
+	$i++;
+      }
+      $db->free();
+    } else {
+      print $db->error();
+    }
+    print "</table>\n";
+    print "</td></tr>";
+
+    print "</table></td></tr>\n";
+    /*
+     *
+     */
+    print "<tr><td valign=\"top\">";
+
+    /*
+     * Propales
+     */
+    $var=!$var;
+    print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"1\">";
+    $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid";
+    $sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id";
+    $sql .= " AND s.idp = $objsoc->idp ORDER BY p.datep DESC";
+
+    if ( $db->query($sql) ) {
+      $num = $db->num_rows();
+      if ($num >0 ) {
+	print "<tr $bc[$var]><td colspan=\"4\"><a href=\"propal.php3?socidp=$objsoc->idp\">liste des propales ($num)</td></tr>";
+      }
+      $i = 0;	$now = time(); 	$lim = 3600 * 24 * 15 ;
+      while ($i < $num && $i < 2) {
+	$objp = $db->fetch_object( $i);
+	$var=!$var;
+	print "<TR $bc[$var]>";
+	print "<TD><a href=\"propal.php3?propalid=$objp->propalid\">$objp->ref</a>\n";
+	if ( ($now - $objp->dp) > $lim && $objp->statutid == 1 ) {
+	  print " <b>&gt; 15 jours</b>";
+	}
+	print "</td><TD align=\"right\">".strftime("%d %B %Y",$objp->dp)."</TD>\n";
+	print "<TD align=\"right\">".price($objp->price - $objp->remise)."</TD>\n";
+	print "<TD align=\"center\">$objp->statut</TD></tr>\n";
+	$i++;
+      }
+      $db->free();
+    }
+    /*
+     *   Factures
+     */
+    $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount, ".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid ";
+    $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND s.idp = $objsoc->idp ORDER BY f.datef DESC";
+    if ( $db->query($sql) ) {
+      $num = $db->num_rows(); $i = 0; 
+      if ($num > 0) {
+	print "<tr $bc2[$var]>";
+	print "<td colspan=\"3\"><a href=\"../compta/index.php3?socidp=$objsoc->idp\">liste des factures ($num)</td></tr>";
+      }
+
+      while ($i < $num && $i < 2) {
+	$objp = $db->fetch_object( $i);
+	$var=!$var;
+	print "<TR $bc2[$var]>";
+	print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
+	if ($objp->df > 0 ) {
+	  print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
+	} else {
+	  print "<TD align=\"right\"><b>!!!</b></TD>\n";
+	}
+	print "<TD align=\"right\">".number_format($objp->amount, 2, ',', ' ')."</TD>\n";
+	$paye[1] = "payée";
+	$paye[0] = "<b>non payée</b>";
+	print "<TD align=\"center\">".$paye[$objp->paye]."</TD>\n";
+	print "</TR>\n";
+	$i++;
+      }
+      $db->free();
+    } else {
+      print $db->error();
+    }
+    print "</table>";
+
+    print "</td><td valign=\"top\">";
+    /*
+     *
+     *  Ventes
+     *
+     */
+    $sql  = "SELECT p.rowid,p.label,p.ref,".$db->pdate("v.dated")." as dd,".$db->pdate("v.datef")." as df";
+    $sql .= " FROM llx_product as p, llx_ventes as v WHERE p.rowid = v.fk_product AND v.fk_soc = $objsoc->idp ORDER BY dated DESC";
+    if ( $db->query($sql) ) {
+      print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">";
+      $i = 0 ; $num = $db->num_rows();
+      if ($num > 0) {
+	$tag = !$tag; print "<tr $bc[$tag]>";
+	print "<td colspan=\"3\"><a href=\"../compta/index.php3?socidp=$objsoc->idp\">liste des ventes ($num)</td></tr>";
+      }
+      while ($i < $num && $i < 5) {
+	$obj = $db->fetch_object( $i);
+	$tag = !$tag;
+	print "<tr $bc[$tag]>";
+	$nw = time();
+	if ($nw <= $obj->df && $nw >= $obj->dd) {
+	  print "<td><b>$obj->label</b></td>";
+	} else {
+	  print "<td>$obj->label</td>";
+	}
+	print "<td align=\"right\">".strftime("%d %b %Y", $obj->dd) ."</td><td align=\"right\">".strftime("%d %b %Y", $obj->df) ."</tr>";
+	$i++;
+      }
+      $db->free();
+      print "</table>";
+    } else {
+      print $db->error();
+    }
+    /*
+     *
+     * Liste des projets associés
+     *
+     */
+    $sql  = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do";
+    $sql .= " FROM llx_projet as p WHERE p.fk_soc = $objsoc->idp";
+    if ( $db->query($sql) ) {
+      print "<table border=1 cellspacing=0 width=100% cellpadding=\"1\">";
+      $i = 0 ; 
+      $num = $db->num_rows();
+      if ($num > 0) {
+	$tag = !$tag; print "<tr $bc[$tag]>";
+	print "<td colspan=\"2\"><a href=\"projet/index.php3?socidp=$objsoc->idp\">liste des projets ($num)</td></tr>";
+      }
+      while ($i < $num && $i < 5) {
+	$obj = $db->fetch_object( $i);
+	$tag = !$tag;
+	print "<tr $bc[$tag]>";
+	print '<td><a href="projet/fiche.php3?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
+
+	print "<td align=\"right\">".strftime("%d %b %Y", $obj->do) ."</td></tr>";
+	$i++;
+      }
+      $db->free();
+      print "</table>";
+    } else {
+      print $db->error();
+    }
+
+    /*
+     *
+     *
+     */
+    print "</td></tr>";
+    print "</table>\n";
+    /*
+     *
+     *
+     *
+     */
+    if ($action == 'changevalue') {
+
+      print "<HR noshade>";
+      print "<form action=\"index.php3?socid=$objsoc->idp\" method=\"post\">";
+      print "<input type=\"hidden\" name=\"action\" value=\"cabrecrut\">";
+      print "Cette société est un cabinet de recrutement : ";
+      print "<select name=\"selectvalue\">";
+      print "<option value=\"\">";
+      print "<option value=\"t\">Oui";
+      print "<option value=\"f\">Non";
+      print "</select>";
+      print "<input type=\"submit\" value=\"Mettre &agrave; jour\">";
+      print "</form>\n";
+    } else {
+      /*
+       *
+       * Liste des contacts
+       *
+       */
+      print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=2>";
+
+      print "<tr><td><b>Pr&eacute;nom Nom</b></td>";
+      print '<td><b>Poste</b></td><td><b>T&eacute;l</b></td>';
+      print "<td><b>Fax</b></td><td><b>Email</b></td>";
+      print "<td><a href=\"people.php3?socid=$objsoc->idp&action=addcontact\">Ajouter</a></td></tr>";
+    
+      $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note FROM socpeople as p WHERE p.fk_soc = $objsoc->idp  ORDER by p.datec";
+      $result = $db->query($sql);
+      $i = 0 ; $num = $db->num_rows(); $tag = True;
+      while ($i < $num) {
+	$obj = $db->fetch_object( $i);
+	if ($tag) {
+	  print "<tr bgcolor=\"e0e0e0\">";
+	} else {
+	  print "<tr>";
+	}
+	print "<td>$obj->firstname $obj->name";
+	if ($obj->note) {
+	  print "<br><b>".nl2br($obj->note);
+	}
+	print "</td>";
+	print "<td>$obj->poste&nbsp;</td>";
+	print '<td><a href="actioncomm.php3?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->phone.'</a>&nbsp;</td>';
+	print "<td>$obj->fax&nbsp;</td>";
+	print '<td><a href="actioncomm.php3?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$objsoc->idp.'">'.$obj->email.'</a>&nbsp;</td>';
+	print "<td><a href=\"people.php3?socid=$objsoc->idp&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
+	print "</tr>\n";
+	$i++;
+	$tag = !$tag;
+      }
+      print "</table>";
+    
+    
+      print "\n<hr noshade size=1>\n";
+      /*
+       *
+       */
+      print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n<tr><td valign=\"top\">\n";
+      /*
+       *
+       * Liste des statuts commerciaux
+       *
+       */
+      $limliste = 5 ;
+      print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n";
+
+      $sql  = "SELECT a.id, ".$db->pdate("a.datel")." as da, c.libelle, a.author ";
+      $sql .= " FROM socstatutlog as a, c_stcomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_statut ORDER by a.datel DESC";
+      if ( $db->query($sql) ) {
+	$i = 0 ; $num = $db->num_rows(); $tag = True;
+	while ($i < $num && $i < $limliste) {
+	  $obj = $db->fetch_object( $i);
+	  if ($tag) {
+	    print "<tr bgcolor=\"e0e0e0\">";
+	  } else {
+	    print "<tr>";
+	  }
+	  print "<td>".  strftime("%d %b %Y %H:%M", $obj->da)  ."</td>";
+	  print "<td>$obj->libelle</td>";
+	  print "<td>$obj->author</td>";
+	  print "</tr>\n";
+	  $i++;
+	  $tag = !$tag;
+	}
+	$db->free();
+	if ($num > $limliste) {
+	  print "<tr><td>suite ...</td></tr>";
+	}
+      } else {
+	print $db->error();
+      }
+      print "</table>";
+
+      print "</td><td valign=\"top\">";
+      /*
+       *
+       *      Listes des actions
+       *
+       */
+      $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.author, a.propalrowid ";
+      $sql .= " FROM actioncomm as a, c_actioncomm as c WHERE a.fk_soc = $objsoc->idp AND c.id=a.fk_action ORDER BY a.datea DESC, a.id DESC";
+      if ( $db->query($sql) ) {
+	print "<table width=\"100%\" cellspacing=0 border=0 cellpadding=2>\n";
+	print '<tr><td><a href="actioncomm.php3?socid='.$objsoc->idp.'">Actions</a></td></tr>';
+
+	$i = 0 ; $num = $db->num_rows(); $tag = True;
+	while ($i < $num) {
+	  $obj = $db->fetch_object( $i);
+	  if ($tag) {
+	    print "<tr bgcolor=\"e0e0e0\">";
+	  } else {
+	    print "<tr>";
+	  }
+	  print "<td>".  strftime("%d %b %Y %H:%M", $obj->da)  ."</td>";
+
+	  if ($obj->propalrowid) {
+	    print "<td><a href=\"propal.php3?propalid=$obj->propalrowid\">$obj->libelle</a></td>";
+	  } else {
+	    print "<td>$obj->libelle</td>";
+	  }
+	  print "<td>$obj->author</td>";
+	  print "</tr>\n";
+	  $i++;
+	  $tag = !$tag;
+	}
+	print "</table>";
+
+	$db->free();
+      } else {
+	print $db->error();
+      }
+      print "</td></tr></table>";    
+      /*
+       * Note sur la societe
+       */
+
+      print '<table border="1" width="100%" cellspacing="0" bgcolor="#e0e0e0">';
+      print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
+      print "</table>";
+
+      /*
+       *
+       *    Offres
+       *
+       */
+      $sql = "SELECT o.idp, o.titre, ";
+      $sql .= $db->pdate("o.datea")." as da, ".$db->pdate("o.dated")." as dd,";
+      $sql .= $db->pdate("o.datec")." as dc,o.active,o.deacmeth, o.site FROM offre as o";
+      $sql .= " WHERE o.fk_soc = $objsoc->idp AND o.created =1";
+      $sql .= " ORDER BY o.datea DESC";
+    
+      $result = $db->query($sql);
+      $num = $db->num_rows();
+      $i = 0;
+    
+      if ($num > 0)
+	{
+
+	  $bc1="bgcolor=\"#c0f0c0\"";
+	  $bc3="bgcolor=\"#90c090\"";
+	  $bc2="bgcolor=\"#b0e0b0\"";
+    
+	  print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
+	  print "<TR bgcolor=\"orange\">";
+	  print "<TD>$num</td>";
+	  print "<TD><a href=\"index.php3?sortfield=s.idp&sortorder=$sortorder\">IDP</a></TD>";
+	  print "<TD>Site</TD>";
+	  print "<TD>Statut</TD>";
+	  print "<TD><a href=\"index.php3?sortfield=s.nom&sortorder=$sortorder\">Titre</a></td>";
+	  print "<TD align=\"center\">Cr&eacute;&eacute;e</TD>";
+	  print "<TD align=\"center\">Activ&eacute;e</TD>";
+	  print "<TD align=\"center\"><a href=\"index.php3?sortfield=s.datea&sortorder=$sortorder\">Dated</a></TD>";
+	  print "<TD align=\"center\">Meth</TD>";
+	  print "</TR>\n";
+	  $var=True;
+	  while ($i < $num) {
+	    $objo = $db->fetch_object( $i);
+	    $var=!$var;
+	    
+	    if (!$var) {
+	      $bc=$bc1;
+	    } else {
+	      $bc=$bc2;
+	    }
+	    if ($objo->active < -2) {
+	  $bc = $bc3;
+	    }
+      
+	    print "<TR $bc>";
+	    print "<TD>" . ($i + 1 + ($limit * $page)) . "</TD>";
+	    print "<TD>$objo->idp</TD>";
+	    print "<TD align=\"center\">$objo->site</TD>";
+	    if ($objo->active == 1) {
+	      print "<TD><b>" . $active["$objo->active"] ."</b></TD>";
+	    } else {
+	      print "<TD>" . $active["$objo->active"] ."</TD>";
+	    }
+	    print "<TD><a href=\"../prod/offre.php3?id=$objo->idp\">$objo->titre</A></TD>\n";
+	    print "<TD align=\"center\">" . strftime("%d %b %Y", $objo->dc) . "</TD>";
+	    print "<TD align=\"center\">" . strftime("%d %b %Y", $objo->da) . "</TD>";
+	    if ($objo->active <> -2) {
+	      print "<TD align=\"center\">" . strftime("%d %b %Y", $objo->dd) . "</TD>";
+	    } else {
+	      print "<TD align=\"center\">&nbsp;</TD>";
+	    }
+	    if ($objo->active == -3) {
+	      print "<TD>".$deacmeth[$objo->deacmeth]."</TD>";
+	    } else {
+	      print "<TD align=\"center\">&nbsp;</TD>";
+	    }
+
+	    print "</TR>\n";
+	    $i++;
+	  }
+	  print "</TABLE>";    
+	}
+      /*
+       *
+       *
+       *
+       */
+      print "<HR noshade>";
+      print "<form action=\"index.php3?socid=$objsoc->idp\" method=\"post\">";
+      print "<input type=\"hidden\" name=\"action\" value=\"recontact\">";
+
+      $strmonth[1] = "Janvier";
+      $strmonth[2] = "F&eacute;vrier";
+      $strmonth[3] = "Mars";
+      $strmonth[4] = "Avril";
+      $strmonth[5] = "Mai";
+      $strmonth[6] = "Juin";
+      $strmonth[7] = "Juillet";
+      $strmonth[8] = "Ao&ucirc;t";
+      $strmonth[9] = "Septembre";
+      $strmonth[10] = "Octobre";
+      $strmonth[11] = "Novembre";
+      $strmonth[12] = "D&eacute;cembre";
+    
+      $smonth = 1;
+      $syear = date("Y", time());
+      print "A recontacter : ";
+      print "<select name=\"reday\">";    
+      for ($day = 1 ; $day < $sday + 32 ; $day++) {
+	print "<option value=\"$day\">$day";
+      }
+      print "</select>";
+      $cmonth = date("n", time());
+      print "<select name=\"remonth\">";    
+      for ($month = $smonth ; $month < $smonth + 12 ; $month++) {
+	if ($month == $cmonth) {
+	  print "<option value=\"$month\" SELECTED>" . $strmonth[$month];
+	} else {
+	  print "<option value=\"$month\">" . $strmonth[$month];
+	}
+      }
+      print "</select>";
+    
+      print "<select name=\"reyear\">";
+    
+      for ($year = $syear ; $year < $syear + 5 ; $year++) {
+	print "<option value=\"$year\">$year";
+      }
+      print "</select>";
+      print "<input type=\"submit\" value=\"Ajouter\">";
+      print "</form>\n";
+
+      /*
+       *
+       *      Listes des actions
+       *
+       */
+      $sql = "SELECT ".$db->pdate("sc.datec")." as da, sc.fk_cand ";
+      $sql .= " FROM soccontact as sc WHERE sc.fk_soc = $objsoc->idp ORDER BY sc.datec DESC";
+      $result = $db->query($sql);
+      $num = $db->num_rows(); 
+      if ($num > 0) 
+	{
+	  $tag = True;
+	  $i = 0 ; 
+
+	  print "<table width=100%><tr><td valign=top width=50%>";
+	  print "Contacts<hr noshade><table cellspacing=0 border=0 cellpadding=2>";
+	  print "<tr><td>date</td><td>Candidat</td></tr>";
+
+	  while ($i < $num) {
+	    $obj = $db->fetch_object( $i);
+	    if ($tag) {
+	      print "<tr bgcolor=\"e0e0e0\">";
+	    } else {
+	      print "<tr>";
+	    }
+	    print "<td>".  strftime("%d %b %Y %H:%M", $obj->da)  ."</td>";
+	    print "<td align=\"center\">$obj->fk_cand</td>";
+	    print "</tr>\n";
+	    $i++;
+	    $tag = !$tag;
+	  }
+	  print "</table>";
+	  print "</td><td valign=top width=50%>";
+	  print "Description de la société<hr noshade>$objsoc->description";
+	  print "</td></tr></table>";    
+
+	}
+    }
+  }
+} else {
+  /*
+   * Mode Liste
+   *
+   *
+   *
+   */
+
+  $bc[1]="bgcolor=\"#90c090\"";
+  $bc[0]="bgcolor=\"#b0e0b0\"";
+
+  $sql = "SELECT s.idp, s.nom, cabrecrut,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, s.c_nom,s.c_prenom,s.c_tel,s.c_mail, s.cjn,st.libelle as stcomm, s.prefix_comm FROM societe as s, c_stcomm as st WHERE s.fk_stcomm = st.id AND s.datea IS NOT NULL";
+
+  if (strlen($stcomm)) {
+    $sql .= " AND s.fk_stcomm=$stcomm";
+  }
+
+  if (strlen($begin)) {
+    $sql .= " AND upper(s.nom) like '$begin%'";
+  }
+
+  if ($aclasser==1) {
+    $sql .= " AND cabrecrut is null";
+  }
+
+  if ($coord == 1) {
+    $sql .= " AND view_res_coord=1";
+  }
+
+  if ($socname) {
+    $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'";
+    $sortfield = "lower(s.nom)";
+    $sortorder = "ASC";
+  }
+
+  $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
+
+  $result = $db->query($sql);
+  if ($result) {
+    $num = $db->num_rows();
+    $i = 0;
+
+    if ($sortorder == "DESC") {
+      $sortorder="ASC";
+    } else {
+      $sortorder="DESC";
+    }
+    print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
+    print "<TR bgcolor=\"orange\">";
+    print "<TD align=\"center\"><a href=\"index.php3?sortfield=idp&sortorder=$sortorder&begin=$begin\">Id</a></TD>";
+    print "<TD><a href=\"index.php3?sortfield=lower(s.nom)&sortorder=$sortorder&begin=$begin\">Societe</a></td>";
+    print "<TD>Contact</TD>";
+    print "<TD>email</TD>";
+    print "<TD align=\"center\">Statut</TD><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>";
+    print "</TR>\n";
+    $var=True;
+    while ($i < $num) {
+      $obj = $db->fetch_object( $i);
+      
+      $var=!$var;
+
+      print "<TR $bc[$var]>";
+      print "<TD align=\"center\"><b>$obj->idp</b></TD>";
+      print "<TD><a href=\"index.php3?socid=$obj->idp\">$obj->nom</A></td>\n";
+      print "<TD>$obj->c_nom $obj->c_prenom</TD>\n";
+      print "<TD>$obj->c_mail</TD>\n";
+      print "<TD align=\"center\">$obj->stcomm</TD>\n";
+      print "<TD align=\"center\">$obj->prefix_comm&nbsp;</TD>\n";
+      print "<TD><a href=\"addpropal.php3?socidp=$obj->idp&action=create\">[Propal]</A></td>\n";
+      print "<TD><a href=\"ventes.php3?socid=$obj->idp&action=add\">[Ventes]</A></TD>\n";
+      print "</TR>\n";
+      $i++;
+    }
+    print "</TABLE>";
+    $db->free();
+  } else {
+    print $db->error();
+  }
+}
+$db->close();
+
+llxFooter();
+?>

+ 151 - 0
htdocs/comm/pre.inc.php3

@@ -0,0 +1,151 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+$root = "/$PREFIX";
+
+require ("/$GLJ_WWW_ROOT/conf/$GLJ_PREFIX.$GLJ_COUNTRY.inc.php3");
+require ("/$GLJ_WWW_ROOT/../www/lib/db.lib.php3");
+require("../main.inc.php3");
+
+function llxHeader($head = "", $urlp = "") {
+  global $PREFIX, $user;
+
+  print "<HTML>\n<HEAD>$head\n</HEAD>\n";
+  ?>
+  <BODY BGCOLOR="#c0c0c0" TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
+  <?PHP
+
+  print "<TABLE border=\"0\" width=\"100%\">\n";
+  print "<TR bgcolor=\"".$GLOBALS["TOPBAR_BGCOLOR"]."\">";
+  
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\"><B>" . $GLOBALS["MAIN_TITLE"] . "</B></TD>";
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../tech/\">Technique</A></TD>";
+  print "<TD width=\"20%\" align=\"center\"><A href=\"".$urlp."../comm/\">Commercial</A></TD>";
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../compta/\">Compta</A></TD>";
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../stats/\">Stats</A></TD>";
+  print "</TR></TABLE>\n";
+
+  print "<TABLE border=\"1\" width=\"100%\" cellpadding=\"0\">";
+  print "<TR><TD valign=\"top\" align=\"right\">";
+
+  print "<TABLE border=\"1\" cellspacing=\"0\" width=\"100%\" cellpadding=\"3\">";
+  print "<TR><TD valign=\"top\" align=\"right\">";
+  print "<center><b>" . $GLOBALS["dbname"] . " - " . $user->code ."</B></center>";
+  print "<A href=\"".$urlp."../\">Accueil</A><br>";
+  print "<A href=\"".$urlp."bookmark.php3\">Bookmark</A>";
+  print "</td></tr>";
+  print "<tr><td valign=\"top\" align=\"right\">";
+
+  print "<CENTER><A href=\"".$urlp."index.php3\">Societe</A></CENTER>\n";
+  print "<A href=\"".$urlp."index.php3?stcomm=1\">A contacter</A><BR>\n";
+  print "<A href=\"".$urlp."index.php3?stcomm=0\">Jamais contactée</A><BR>\n";
+  print "<A href=\"".$urlp."index.php3?stcomm=-1\">Ne pas contacter</A><BR>\n";
+  print "<A href=\"".$urlp."index.php3?stcomm=2\">Contact en cours</A><BR>\n";
+  print "<A href=\"".$urlp."index.php3?stcomm=3\">Contactée</A><p>\n";
+  print "<A href=\"".$urlp."relance.php3\">A relancer</A><BR>\n";
+  print "<A href=\"".$urlp."recontact.php3\">A recontacter</A><BR>\n";
+  print "<A href=\"".$urlp."index.php3?aclasser=1\">A classer</A><p>\n";
+
+  print "<A href=\"".$urlp."topcontact.php3\">Gourmands</A><BR>\n";
+  print "<A href=\"".$urlp."contact.php3\">Contact</A><BR>\n";
+  print "</TD></TR>";
+
+
+  print "<TR><TD valign=\"top\" align=\"right\">";
+  print "<div align=\"center\"><A href=\"".$urlp."actioncomm.php3\">Actions</A></div>\n";
+  print "<A href=\"".$urlp."actioncomm.php3?type=9\">Factures</A><BR>\n";
+  print "<A href=\"".$urlp."actioncomm.php3?type=5\">Propal FE</A><BR>\n";
+  print "<A href=\"".$urlp."actioncomm.php3?type=11\">Cl&ocirc;ture</A><p>\n";
+  print "</TD></TR>";
+  /*
+   *
+   */
+  print "<TR><TD valign=\"top\" align=\"right\">";
+  print "<div align=\"center\"><A href=\"".$urlp."propal.php3\">Propal</A></div>\n";
+  print "<A href=\"".$urlp."analyse.php3\">Recap</A><br>\n";
+  print "</TD></TR>";
+  /*
+   *
+   */
+  print "<TR><TD valign=\"top\" align=\"right\" bgcolor=\"#e0e0e0\">";
+
+  print "<A href=\"".$urlp."../compta/\">Factures</A><BR>\n";
+  print "<center><A href=\"".$urlp."ventes.php3\">Ventes</A></center>\n";
+  print "<A href=\"".$urlp."ventes_soc.php3\">Par sociétés</A><BR>\n";
+  print "<A href=\"".$urlp."product.php3\">Produits</A><BR>\n";
+
+  print "</td></tr>";
+
+  print "<tr><td align=\"right\" valign=\"top\">";
+  print "<A href=\"projet/\">Projets</A><BR>\n";
+  print "</td></tr>";
+
+
+  print "<tr><td align=\"right\" valign=\"top\">";
+  print "<A href=\"".$urlp."stats/\">Stats</A><BR>\n";
+  print "</td></tr>";
+
+  print "<tr><td align=\"right\" valign=\"top\">";
+  print "<CENTER><A href=\"".$urlp."index.php3\">Societes</A></CENTER>\n";
+  print "<form action=\"index.php3\">";
+  print '<input type="hidden" name="mode" value="search">';
+  print '<input type="hidden" name="mode-search" value="soc">';
+  print '<input type="text" name="socname" size="8">&nbsp;';
+  print "<input type=\"submit\" value=\"go\">";
+  print "</form>";
+
+  print "<CENTER><A href=\"".$urlp."contact.php3\">Contacts</A></CENTER>\n";
+  print "<form action=\"".$urlp."contact.php3\">";
+  print '<input type="hidden" name="mode" value="search">';
+  print '<input type="hidden" name="mode-search" value="contact">';
+  print "<input type=\"text\" name=\"contactname\" size=\"8\">&nbsp;";
+  print "<input type=\"submit\" value=\"go\">";
+  print "</form>";
+
+
+  print "<form action=\"index.php3\">";
+  print "Soc : <input type=\"text\" name=\"socid\" size=\"5\">";
+  print "<input type=\"submit\" value=\"id\">";
+  print "</form>";
+  print "</td></tr>";
+
+  print "</table>";
+
+  print "</td>";
+
+
+  print "<TD valign=\"top\" width=\"85%\">\n";
+}
+
+function llxFooter($foot='') {
+  print "</TD></TR>";
+  /*
+   *
+   */
+  print "</TABLE>\n";
+  print "$foot</BODY></HTML>";
+}
+/*
+ * $Id$
+ * $Source$
+ */
+?>

+ 136 - 0
htdocs/comm/projet/fiche.php3

@@ -0,0 +1,136 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+require("./pre.inc.php3");
+require("../../lib/functions.inc.php3");
+require("./project.class.php3");
+require("../propal.class.php3");
+
+llxHeader("","../");
+print "<table width=\"100%\">";
+print "<tr><td>Projets</td>";
+
+print "</table>";
+
+$bc[0]="bgcolor=\"#90c090\"";
+$bc[1]="bgcolor=\"#b0e0b0\"";
+
+$db = new Db();
+
+if ($sortfield == "") {
+  $sortfield="lower(p.label)";
+}
+if ($sortorder == "") {
+  $sortorder="ASC";
+}
+
+$yn["t"] = "oui";
+$yn["f"] = "non";
+
+if ($page == -1) { $page = 0 ; }
+$limit = 26;
+$offset = $limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+
+if ($action == 'create') {
+?>
+
+<form action="index.php3" method="post">
+<table border=1 cellpadding="1" cellspacing="0">
+<input type="hidden" name="action" value="create">
+<tr><td>Société</td><td>
+<?PHP print '<input type="text" name="socidp" value="'.$socidp.'">'; ?>
+</td></tr>
+<?PHP
+print '<tr><td>Créateur</td><td>'.$user->fullname.'</td></tr>';
+?>
+<tr><td>Ref</td><td><input type="text" name="ref"></td></tr>
+<tr><td>Titre</td><td><input type="text" name="title"></td></tr>
+<tr><td colspan="2"><input type="submit"></td></tr>
+</table>
+</form>
+<?PHP
+
+} else {
+  $propales = array();
+  $projet = new Project();
+  $projet->fetch($db, $id);
+
+  print '<table border=1 cellpadding="1" cellspacing="0">';
+  print '<tr><td>Société</td><td></td></tr>';
+
+  print '<tr><td>Ref</td><td>'.$projet->ref.'</td></tr>';
+  print '<tr><td>Titre</td><td>'.$projet->title.'</td></tr>';
+  print '</table>';
+  
+  $propales = $projet->get_propal_list($db);
+
+  if (sizeof($propales)>0 && is_array($propales)) {
+
+    print '<p>Listes des propales associées au projet';
+    print '<TABLE border="0" width="100%" cellspacing="0" cellpadding="4">';
+
+    print "<TR bgcolor=\"#e0e0e0\">";
+    print "<TD>Réf</TD>";
+    print '<TD>Date</TD>';
+    print '<TD align="right">Prix</TD>';
+    print '<TD align="center">Statut</TD>';
+    print '</TR>';
+
+    for ($i = 0; $i<sizeof($propales);$i++){
+      $propale = new Propal();
+      $propale->fetch($db, $propales[$i]);
+
+      $var=!$var;
+      print "<TR $bc[$var]>";
+      print "<TD><a href=\"../propal.php3?propalid=$propale->id\">$propale->ref</a></TD>\n";
+
+      print '<TD>'.strftime("%d %B %Y",$propale->datep).'</a></TD>';
+      
+      print '<TD align="right">'.price($propale->price).'</TD>';
+      print '<TD align="center">statut</TD>';
+      print '</TR>';
+  
+      $total = $total + $propale->price;
+    }
+
+    print '<tr><td>'.$i.' propales</td>';
+    print '<td align="right"><small>Soit : '.francs($total).' FF HT</small></td>';
+    print '<td colspan="1" align="right"><b>Total : '.price($total).'</b></td>';
+    print '<td align="left"><b>Euros HT</b></td></tr>';
+
+    print "</TABLE>";
+
+    
+  } else {
+    print "pas de propales";
+  }
+
+
+}
+
+
+
+llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
+?>

+ 126 - 0
htdocs/comm/projet/index.php3

@@ -0,0 +1,126 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ */
+require("./pre.inc.php3");
+require("../../lib/functions.inc.php3");
+require("./project.class.php3");
+
+
+llxHeader("","../");
+print '<table width="100%">';
+print '<tr><td>Projets</td>';
+if($socidp) {
+  print '<td>[<a href="fiche.php3?socidp='.$socidp.'&action=create">Nouveau projet</a>]</td>';
+}
+print '</tr></table>';
+
+$bc[0]="bgcolor=\"#90c090\"";
+$bc[1]="bgcolor=\"#b0e0b0\"";
+
+$db = new Db();
+/*
+ * Traitements des actions
+ *
+ */
+if ($action == 'create') {
+
+  $pro = new Project();
+  $pro->socidp = $socidp;
+  $pro->ref = $ref;
+  $pro->title = $title;
+
+  $pro->create($db, $user->id);
+}
+
+
+
+/*
+ *
+ * Affichage
+ *
+ */
+if ($sortfield == "") {
+  $sortfield="lower(p.label)";
+}
+if ($sortorder == "") {
+  $sortorder="ASC";
+}
+
+$yn["t"] = "oui";
+$yn["f"] = "non";
+
+if ($page == -1) { $page = 0 ; }
+$limit = 26;
+$offset = $limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+
+/*
+ *
+ *
+ * Liste des projets
+ *
+ * 
+ */
+
+print "<P>";
+$sql = "SELECT s.nom, s.idp, p.rowid as projectid, p.ref, p.title,".$db->pdate("p.dateo")." as do";
+$sql .= " FROM societe as s, llx_projet as p";
+$sql .= " WHERE p.fk_soc = s.idp";
+
+if ($socidp) { $sql .= " AND s.idp = $socidp"; }
+
+if ( $db->query($sql) ) {
+  $num = $db->num_rows();
+  $i = 0;
+  print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
+  
+  $oldstatut = -1;
+  $subtotal = 0;
+  while ($i < $num) {
+    $objp = $db->fetch_object( $i);
+    
+    if ($objp->statut <> $oldstatut ) {
+      $oldstatut = $objp->statut;
+      
+      if ($i > 0) {
+	print "<tr><td align=\"right\" colspan=\"6\">Total : <b>".price($subtotal)."</b></td>\n";
+	print "<td align=\"left\">Euros HT</td></tr>\n";
+      }
+      $subtotal = 0;
+      
+      print "<TR bgcolor=\"#e0e0e0\">";
+      print "<TD>[<a href=\"$PHP_SELF\">Tous</a>]</td>";
+      print "<TD><a href=\"$PHP_SELF?sortfield=lower(p.label)&sortorder=ASC\">Societe</a></td>";
+      print "<TD>Réf</TD><td>Titre</td>";
+      print "<TD align=\"right\" colspan=\"2\">Date</TD>";
+      print "<TD align=\"center\">Statut [<a href=\"$PHP_SELF?viewstatut=$objp->statutid\">Filtre</a>]</TD>";
+      print "</TR>\n";
+      $var=True;
+    }
+    
+    $var=!$var;
+    print "<TR $bc[$var]>";
+    print "<TD>[<a href=\"$PHP_SELF?socidp=$objp->idp\">Filtre</a>]</TD>\n";
+    print "<TD><a href=\"../index.php3?socid=$objp->idp\">$objp->nom</a></TD>\n";
+    print "<TD><a href=\"fiche.php3?id=$objp->projectid\">$objp->ref</a></TD>\n";
+    print "<TD><a href=\"fiche.php3?id=$objp->projectid\">$objp->title</a></TD>\n";
+    print "<td>&nbsp;</td>";
+    print "</TR>\n";
+    
+    $i++;
+  }
+
+  print "</TABLE>";
+  $db->free();
+} else {
+  print $db->error();
+}
+
+$db->close();
+llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
+?>

+ 118 - 0
htdocs/comm/projet/pre.inc.php3

@@ -0,0 +1,118 @@
+<?PHP
+/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+$root = "/$PREFIX";
+
+require ("/$GLJ_WWW_ROOT/conf/$GLJ_PREFIX.$GLJ_COUNTRY.inc.php3");
+require ("/$GLJ_WWW_ROOT/../www/lib/db.lib.php3");
+require ("../../main.inc.php3");
+
+function llxHeader($head = "", $urlp = "") {
+  global $PREFIX, $user;
+
+  print "<HTML>\n<HEAD>$head\n</HEAD>\n";
+  ?>
+  <BODY BGCOLOR="#c0c0c0" TOPMARGIN="0" BOTTOMMARGIN="0" LEFTMARGIN="0" RIGHTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0">
+  <?PHP
+
+  print "<TABLE border=\"0\" width=\"100%\">\n";
+  print "<TR bgcolor=\"".$GLOBALS["TOPBAR_BGCOLOR"]."\">";
+  
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\"><B>" . $GLOBALS["MAIN_TITLE"] . "</B></TD>";
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../tech/\">Technique</A></TD>";
+  print "<TD width=\"20%\" align=\"center\"><A href=\"".$urlp."../comm/\">Commercial</A></TD>";
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../compta/\">Compta</A></TD>";
+  print "<TD width=\"20%\" bgcolor=\"#e0e0e0\" align=\"center\"><A href=\"".$urlp."../stats/\">Stats</A></TD>";
+  print "</TR></TABLE>\n";
+
+  print "<TABLE border=\"1\" width=\"100%\" cellpadding=\"0\">";
+  print "<TR><TD valign=\"top\" align=\"right\">";
+
+  print "<TABLE border=\"1\" cellspacing=\"0\" width=\"100%\" cellpadding=\"3\">";
+  print "<TR><TD valign=\"top\" align=\"right\">";
+  print "<center><b>" . $GLOBALS["dbname"] . " - " . $user->code ."</B></center>";
+  print "<A href=\"".$urlp."../\">Accueil</A><br>";
+  print "<A href=\"".$urlp."bookmark.php3\">Bookmark</A>";
+  print "</td></tr>";
+  /*
+   *
+   */
+  print "<TR><TD valign=\"top\" align=\"right\">";
+  print "<div align=\"center\"><A href=\"".$urlp."propal.php3\">Propal</A></div>\n";
+  print "<A href=\"".$urlp."analyse.php3\">Recap</A><br>\n";
+  print "</TD></TR>";
+  /*
+   *
+   */
+  print "<TR><TD valign=\"top\" align=\"right\" bgcolor=\"#e0e0e0\">";
+
+  print "<A href=\"".$urlp."../../compta/\">Factures</A><BR>\n";
+
+  print "<A href=\"".$urlp."product.php3\">Produits</A><BR>\n";
+
+  print "</td></tr>";
+
+  print "<tr><td align=\"right\" valign=\"top\">";
+  print "<CENTER><A href=\"".$urlp."index.php3\">Societes</A></CENTER>\n";
+  print "<form action=\"".$urlp."index.php3\">";
+  print '<input type="hidden" name="mode" value="search">';
+  print '<input type="hidden" name="mode-search" value="soc">';
+  print '<input type="text" name="socname" size="8">&nbsp;';
+  print "<input type=\"submit\" value=\"go\">";
+  print "</form>";
+
+  print "<CENTER><A href=\"".$urlp."index.php3\">Contacts</A></CENTER>\n";
+  print "<form action=\"../index.php3\">";
+  print '<input type="hidden" name="mode" value="search">';
+  print '<input type="hidden" name="mode-search" value="contact">';
+  print "<input type=\"text\" name=\"contactname\" size=\"8\">&nbsp;";
+  print "<input type=\"submit\" value=\"go\">";
+  print "</form>";
+
+
+  print "<form action=\"index.php3\">";
+  print "<input type=\"text\" name=\"socid\" size=\"5\">";
+  print "<input type=\"submit\" value=\"id\">";
+  print "</form>";
+  print "</td></tr>";
+
+  print "</table>";
+
+  print "</td>";
+
+
+  print "<TD valign=\"top\" width=\"85%\">\n";
+}
+
+function llxFooter($foot='') {
+  print "</TD></TR>";
+  /*
+   *
+   */
+  print "</TABLE>\n";
+  print "$foot</BODY></HTML>";
+}
+/*
+ * $Id$
+ * $Source$
+ */
+?>

+ 108 - 0
htdocs/comm/projet/project.class.php3

@@ -0,0 +1,108 @@
+<?PHP
+/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * $Id$
+ * $Source$
+ *
+ * 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.
+ *
+ */
+
+
+class Project {
+  var $id;
+  var $ref;
+  var $title;
+  var $socidp;
+
+  Function Project() {
+
+  }
+  /*
+   *
+   *
+   *
+   */
+
+  Function create($db, $creatorid) {
+
+    $sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat) ";
+    $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid) ;";
+    
+    if (!$db->query($sql) ) 
+      {
+	print '<b>'.$sql.'</b><br>'.$db->error();
+	
+	}
+    
+  }
+  /*
+   *
+   *
+   *
+   */
+
+  Function fetch($db, $rowid) {
+
+    $sql = "SELECT title, ref FROM llx_projet WHERE rowid=$rowid;";
+
+    if ($db->query($sql) ) {
+      if ($db->num_rows()) {
+	$obj = $db->fetch_object(0);
+
+	$this->id = $rowid;
+	$this->ref = $obj->ref;
+	$this->title = $obj->title;
+
+	$db->free();
+      }
+    } else {
+      print $db->error();
+    }
+  }
+  /*
+   *
+   *
+   *
+   */
+  Function get_propal_list($db) {
+    $propales = array();
+    $sql = "SELECT rowid FROM llx_propal WHERE fk_projet=$this->id;";
+
+    if ($db->query($sql) ) {
+      $nump = $db->num_rows();
+      if ($nump) {
+	$i = 0;
+	while ($i < $nump) {
+	  $obj = $db->fetch_object($i);
+
+	  $propales[$i] = $obj->rowid;
+
+	  $i++;
+	}
+	$db->free();
+	/*
+	 *  Retourne un tableau contenant la liste des propales associees
+	 */
+	return $propales;
+      }
+    } else {
+      print $db->error() . '<br>' .$sql;
+    }
+
+
+  }
+}
+?>