/[dolibarr]/dolibarr/htdocs/contrat/contact.php
ViewVC logotype

Diff of /dolibarr/htdocs/contrat/contact.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by eldy, Wed Sep 7 21:50:10 2005 UTC revision 1.4 by eldy, Sat Sep 17 02:06:06 2005 UTC
# Line 95  function select_societes_for_newconcat($ Line 95  function select_societes_for_newconcat($
95  function select_nature_contact($contrat, $defValue, $htmlname = 'nature')  function select_nature_contact($contrat, $defValue, $htmlname = 'nature')
96  {  {
97          $lesNatures = $contrat->liste_nature_contact();          $lesNatures = $contrat->liste_nature_contact();
98          print '<input name="'.$htmlname.'" type="text" size="12" value="'.$defValue.'"> ';          print '<select size="0" name="nature">';
99          print '<select size="0" name="choix" onChange="form.'.$htmlname.'.value=this.value;" >';          foreach($lesNatures as $key=>$value)
         for ($i = 0; $i < count($lesNatures); $i ++)  
100          {          {
101                  print '<option>'.$lesNatures[$i].'</option>';                  print '<option value="'.$key.'">'.$value.'</option>';
102          }          }
103          print "</select>\n";          print "</select>\n";
104  }  }
# Line 122  if ($_POST["action"] == 'addcontact' && Line 121  if ($_POST["action"] == 'addcontact' &&
121          $result = $contrat->fetch($_GET["id"]);          $result = $contrat->fetch($_GET["id"]);
122          if ($_POST["id"] > 0)          if ($_POST["id"] > 0)
123          {          {
124                  $result = $contrat->add_contact($_POST["contactid"], $_POST["newnature"]);                  $result = $contrat->add_contact($_POST["contactid"], $_POST["nature"]);
125          }          }
126    
127          if ($result >= 0)          if ($result >= 0)
# Line 165  if ($_GET["action"] == 'swapstatut' && $ Line 164  if ($_GET["action"] == 'swapstatut' && $
164          if ($contrat->fetch($_GET["id"]))          if ($contrat->fetch($_GET["id"]))
165          {          {
166                  $contact = $contrat->detail_contact($_GET["ligne"]);                  $contact = $contrat->detail_contact($_GET["ligne"]);
167                  $nature = $contact->nature;                  $id_type_contact = $contact->fk_c_type_contact;
168                  $statut = ($contact->statut == 4) ? 5 : 4;                  $statut = ($contact->statut == 4) ? 5 : 4;
169    
170                  $result = $contrat->update_contact($_GET["ligne"], $statut, $nature);                  $result = $contrat->update_contact($_GET["ligne"], $statut, $id_type_contact);
171                  if ($result >= 0)                  if ($result >= 0)
172                  {                  {
173                          $db->commit();                          $db->commit();
# Line 249  if ($id > 0) Line 248  if ($id > 0)
248    
249                  print "</table>";                  print "</table>";
250    
251    
252                    print '</div>';
253    
254    
255                  /*                  /*
256                   * Lignes de contacts                   * Lignes de contacts
257                   */                   */
258                  echo '<br><table class="noborder" width="100%">';                  echo '<br><table class="noborder" width="100%">';
259    
260                    /*
261                     * Ajouter une ligne de contact
262                     * Non affiché en mode modification de ligne
263                     */
264                    if ($_GET["action"] != 'editline' && $user->rights->contrat->creer)
265                    {
266                            print '<tr class="liste_titre">';
267                            print '<td>'.$langs->trans("Societe").'</td>';
268                            print '<td>'.$langs->trans("Contacts").'</td>';
269                            print '<td align="center">'.$langs->trans("ContactType").'</td>';
270                            print '<td colspan="2">&nbsp;</td>';
271                            print "</tr>\n";
272    
273                            $var = false;
274    
275                            print '<form action="contact.php?id='.$id.'" method="post">';
276                            print '<input type="hidden" name="action" value="addcontact">';
277                            print '<input type="hidden" name="id" value="'.$id.'">';
278    
279                            print "<tr $bc[$var]>";
280                            print '<td colspan="1">';
281                            $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$contrat->societe->id;
282                            $selectedCompany = select_societes_for_newconcat($contrat, $selectedCompany, $htmlname = 'newcompany');
283                            print '</td>';
284    
285                            print '<td colspan="1">';
286                            $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid');
287                            print '</td>';
288                            print '<td align="center">';
289                            select_nature_contact($contrat, '', 'nature');
290                            print '</td>';
291                            print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
292                            print '</tr>';
293    
294                            print "</form>";
295    
296                    }
297    
298            print '<tr><td colspan="6">&nbsp;</td></tr>';
299            
300                  print '<tr class="liste_titre">';                  print '<tr class="liste_titre">';
301                  print '<td>'.$langs->trans("Societe").'</td>';                  print '<td>'.$langs->trans("Societe").'</td>';
302                  print '<td>'.$langs->trans("Contacts").'</td>';                  print '<td>'.$langs->trans("Contacts").'</td>';
# Line 286  if ($id > 0) Line 329  if ($id > 0)
329                                  {                                  {
330                                          print '<tr '.$bc[$var].' valign="top">';                                          print '<tr '.$bc[$var].' valign="top">';
331    
332                                            print '<td align="left">';
333                                            if ($objp->fk_soc)
334                                            {
335                                            print '<a href="'.DOL_URL_ROOT.'/soc.php?idp='.$objp->fk_soc.'">';
336                                            print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($person->socid);
337                                            print '</a>';
338                        }
339                        else
340                        {
341                            print '&nbsp;';  
342                        }
343                                            print '</td>';
344    
345                                          print '<td>';                                          print '<td>';
346                                          print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$objp->fk_socpeople.'">';                                          print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$objp->fk_socpeople.'">';
347                                          print $person->fullname.'</a>';                                          print img_object($langs->trans("ShowContact"),"contact").' '.$person->fullname.'</a>';
348                                          print '</td>';                                          print '</td>';
349    
                                         print '<td align="left">'.$societe->get_nom($person->socid).'</td>';  
   
350                                          // Description                                          // Description
351                                          print '<td align="center">'.$objp->nature.'</td>';                                          print '<td align="center">'.$objp->libelle.'</td>';
352    
353                                          // Statut                                          // Statut
354                                          print '<td align="center">';                                          print '<td align="center">';
355                                          // Activation descativation du contact                                          // Activation desativation du contact
356                                          if ($contrat->statut >= 0)                                          if ($contrat->statut >= 0)
357                                                  print '<a href="'.DOL_URL_ROOT.'/contrat/contact.php?id='.$contrat->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i].'">';                                                  print '<a href="'.DOL_URL_ROOT.'/contrat/contact.php?id='.$contrat->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i].'">';
358                                          print img_statut($objp->statut);                                          print img_statut($objp->statut);
# Line 329  if ($id > 0) Line 384  if ($id > 0)
384    
385                                  }                                  }
386                                  // mode edition de une ligne ligne (editline)                                  // mode edition de une ligne ligne (editline)
387                                  // on ne change pas le contact. Seulement la nature                                  // on ne change pas le contact. Seulement le type
388                                  else                                  else
389                                  {                                  {
390    
# Line 340  if ($id > 0) Line 395  if ($id > 0)
395                                          print "<tr $bc[$var]>";                                          print "<tr $bc[$var]>";
396    
397                                          print '<td>';                                          print '<td>';
398                                            if ($objp->fk_soc)
399                                            {
400                                            print '<a href="'.DOL_URL_ROOT.'/soc.php?idp='.$objp->fk_soc.'">';
401                                            print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($person->socid);
402                                            print '</a>';
403                        }
404                        else
405                        {
406                            print '&nbsp;';  
407                        }
408                                            print '</td>';
409    
410                                            print '<td>';
411                                          print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$objp->fk_socpeople.'">';                                          print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$objp->fk_socpeople.'">';
412                                          print $person->fullname.'</a>';                                          print img_object($langs->trans("ShowContact"),"contact").' '.$person->fullname.'</a>';
413                                          print '</td>';                                          print '</td>';
414                                          print '<td align="left">'.$societe->get_nom($person->socid).'</td>';  
415                                          // Description                                          // Description
416                                          print '<td align="center">';                                          print '<td align="center">';
   
417                                          select_nature_contact($contrat, $objp->nature, 'nature');                                          select_nature_contact($contrat, $objp->nature, 'nature');
418                                          print "</td>";                                          print "</td>";
419    
420                                          // Statut                                          // Statut
421                                          print '<td align="center">'.img_statut($objp->statut).'</td>';                                          print '<td align="center">'.img_statut($objp->statut).'</td>';
422    
# Line 363  if ($id > 0) Line 431  if ($id > 0)
431                          $db->free($result);                          $db->free($result);
432                  }                  }
433    
                 /*  
                  * Ajouter une ligne de contact  
                  * uniquement sur les contrats en creation.  
                  * En pas en mode modification de ligne  
                  */  
                 if ($_GET["action"] != 'editline' && $user->rights->contrat->creer && $contrat->statut == 0)  
                 {  
                         print '<tr class="liste_titre">';  
                         print '<td>'.$langs->trans("Societe").'</td>';  
                         print '<td>'.$langs->trans("Contacts").'</td>';  
                         print '<td align="center">'.$langs->trans("ContactType").'</td>';  
                         print '<td colspan="2">&nbsp;</td>';  
                         print "</tr>\n";  
   
                         $var = false;  
   
                         print '<form action="contact.php?id='.$id.'" method="post">';  
                         print '<input type="hidden" name="action" value="addcontact">';  
                         print '<input type="hidden" name="id" value="'.$id.'">';  
   
                         print "<tr $bc[$var]>";  
                         print '<td colspan="1">';  
                         $selectedCompany = $_GET["newcompany"]; // vide pour la premiere recherche  
                         $selectedCompany = select_societes_for_newconcat($contrat, $selectedCompany, $htmlname = 'newcompany');  
                         print '</td>';  
   
                         print '<td colspan="1">';  
                         $html->select_contacts($selectedCompany, $selected = '', $htmlname = 'contactid');  
                         print '</td>';  
                         print '<td align="center">';  
                         select_nature_contact($contrat, "", 'newnature');  
                         print '</td>';  
                         print '<td align="right" colspan="3" ><input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';  
                         print '</tr>';  
   
                         print "</form>";  
   
                 }  
   
434                  print "</table>";                  print "</table>";
435    
                 print '</div>';  
436    
437          } else          } else
438          {          {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26