[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/expedition/ -> fiche.php (source)

   1  <?php
   2  /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2005      Laurent Destailleur  <eldy@users.sourceforge.net>
   4   * Copyright (C) 2005      Simon TOSSER  <simon@kornog-computing.com>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   *
  20   * $Id: fiche.php,v 1.29.2.2 2006/01/14 13:43:08 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/expedition/fiche.php,v $
  22   */
  23  
  24  // Code identique a /expedition/commande.php
  25  
  26  /**
  27          \file       htdocs/expedition/fiche.php
  28          \ingroup    expedition
  29          \brief      Fiche descriptive d'une expedition
  30          \version    $Revision: 1.29.2.2 $
  31  */
  32  
  33  require ("./pre.inc.php");
  34  require_once(DOL_DOCUMENT_ROOT."/product.class.php");
  35  require_once (DOL_DOCUMENT_ROOT."/propal.class.php");
  36  require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
  37  
  38  $langs->load("bills");
  39  
  40  $user->getrights('expedition');
  41  if (!$user->rights->expedition->lire)
  42    accessforbidden();
  43  
  44  
  45  // Sécurité accés client
  46  if ($user->societe_id > 0) 
  47  {
  48    $action = '';
  49    $socidp = $user->societe_id;
  50  }
  51  
  52  
  53  /*
  54   * Actions
  55   */
  56  
  57  if ($_POST["action"] == 'add') 
  58  {
  59      $db->begin();
  60      
  61      // Creation de l'objet expedition
  62      $expedition = new Expedition($db);
  63      
  64      $expedition->date_expedition  = time();
  65      $expedition->note             = $_POST["note"];
  66      $expedition->commande_id      = $_POST["commande_id"];
  67      $expedition->entrepot_id      = $_POST["entrepot_id"];
  68      
  69      // On boucle sur chaque ligne de commande pour compléter objet expedition
  70      // avec qté à livrer
  71      $commande = new Commande($db);
  72      $commande->fetch($expedition->commande_id);
  73      $commande->fetch_lignes();
  74      for ($i = 0 ; $i < sizeof($commande->lignes) ; $i++)
  75      {
  76          $qty = "qtyl".$i;
  77          $idl = "idl".$i;
  78          if ($_POST[$qty] > 0)
  79          {
  80              $expedition->addline($_POST[$idl],$_POST[$qty]);
  81          }
  82      }
  83      
  84      $ret=$expedition->create($user);
  85      if ($ret > 0)
  86      {
  87          $db->commit();
  88          Header("Location: fiche.php?id=".$expedition->id);
  89          exit;
  90      }
  91      else
  92      {
  93          $db->rollback();
  94          $mesg='<div class="error">'.$expedition->error.'</div>';
  95          $_GET["commande_id"]=$_POST["commande_id"];
  96          $_GET["action"]='create';
  97      }
  98  }
  99  
 100  if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes' && $user->rights->expedition->valider)
 101  {
 102    $expedition = new Expedition($db);
 103    $expedition->fetch($_GET["id"]);
 104    $result = $expedition->valid($user);
 105    $expedition->PdfWrite();
 106  }
 107  
 108  if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
 109  {
 110    if ($user->rights->expedition->supprimer ) 
 111      {
 112        $expedition = new Expedition($db);
 113        $expedition->id = $_GET["id"];
 114        $expedition->delete();
 115        Header("Location: liste.php");
 116      }
 117  }
 118  
 119  /*
 120   * Générer ou regénérer le PDF
 121   */
 122  
 123  if ($_GET["action"] == 'pdf')
 124  {
 125    $expedition = new Expedition($db);
 126    $expedition->fetch($_GET["id"]);
 127    $expedition->PdfWrite();
 128  }
 129  
 130  
 131  /*
 132   *
 133   */
 134  
 135  $html = new Form($db);
 136  
 137  /*********************************************************************
 138   *
 139   * Mode creation
 140   *
 141   *********************************************************************/
 142  if ($_GET["action"] == 'create') 
 143  {
 144    llxHeader('','Fiche expedition','ch-expedition.html',$form_search);
 145  
 146    print_titre($langs->trans("CreateASending"));
 147  
 148    if ($mesg)
 149    {
 150          print $mesg.'<br>';
 151    }
 152    
 153    $commande = new Commande($db);
 154    $commande->livraison_array();
 155    
 156    if ( $commande->fetch($_GET["commande_id"]))
 157      {
 158        $soc = new Societe($db);
 159        $soc->fetch($commande->soc_id);
 160        $author = new User($db);
 161        $author->id = $commande->user_author_id;
 162        $author->fetch();
 163        
 164        $entrepot = new Entrepot($db);
 165        /*
 166         *   Commande
 167         */
 168        print '<form action="fiche.php" method="post">';
 169        print '<input type="hidden" name="action" value="add">';
 170        print '<input type="hidden" name="commande_id" value="'.$commande->id.'">';
 171        print '<input type="hidden" name="entrepot_id" value="'.$_GET["entrepot_id"].'">';
 172        print '<table class="border" width="100%">';
 173        print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
 174        print '<td width="30%"><b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
 175        
 176        print '<td width="50%" colspan="2">';
 177  
 178        print "</td></tr>";
 179        
 180        print "<tr><td>".$langs->trans("Date")."</td>";
 181        print "<td>".strftime("%A %d %B %Y",$commande->date)."</td>\n";
 182        
 183        print '<td>'.$langs->trans("Order").'</td><td><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id.'">'.img_object($langs->trans("ShowOrder"),'order').' '.$commande->ref.'</a>';
 184        print "</td></tr>\n";
 185        
 186        print '<tr><td>'.$langs->trans("Warehouse").'</td>';
 187        print '<td>';
 188        $ents = $entrepot->list_array();
 189        print '<a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$_GET["entrepot_id"].'">'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].'</a>';
 190        print '</td>';
 191        print "<td>".$langs->trans("Author")."</td><td>$author->fullname</td>\n";
 192        
 193        if ($commande->note)
 194      {
 195        print '<tr><td colspan="3">Note : '.nl2br($commande->note)."</td></tr>";
 196      }
 197        print "</table>";
 198        
 199        /*
 200         * Lignes de commandes
 201         *
 202         */
 203        echo '<br><table class="noborder" width="100%">';
 204        
 205        $lignes = $commande->fetch_lignes(1);
 206        
 207        /* Lecture des livraisons déjà effectuées */
 208        $commande->livraison_array();
 209        
 210        $num = sizeof($commande->lignes);
 211        $i = 0;
 212        
 213        if ($num)
 214      {
 215        print '<tr class="liste_titre">';
 216        print '<td width="54%">'.$langs->trans("Description").'</td>';
 217        print '<td align="center">Quan. commandée</td>';
 218        print '<td align="center">Quan. livrée</td>';
 219        print '<td align="center">Quan. à livrer</td>';
 220        if ($conf->stock->enabled)
 221          {
 222            print '<td width="12%" align="center">'.$langs->trans("Stock").'</td>';
 223          }
 224        print "</tr>\n";
 225      }
 226        $var=true;
 227        while ($i < $num)
 228      {
 229        $ligne = $commande->lignes[$i];
 230        $var=!$var;
 231        print "<tr $bc[$var]>\n";
 232        if ($ligne->product_id > 0)
 233          {      
 234            $product = new Product($db);
 235            $product->fetch($ligne->product_id);
 236            
 237            print '<td>';
 238            print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->product_id.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
 239            if ($ligne->description) print nl2br($ligne->description);
 240            print '</td>';
 241          }
 242        else
 243          {
 244            print "<td>".nl2br($ligne->description)."</td>\n";
 245          }
 246        
 247        print '<td align="center">'.$ligne->qty.'</td>';
 248        /*
 249         *
 250         */
 251        print '<td align="center">';
 252        $quantite_livree = $commande->livraisons[$ligne->product_id];
 253        print $quantite_livree;;
 254        print '</td>';
 255  
 256        $quantite_commandee = $ligne->qty;
 257        $quantite_a_livrer = $quantite_commandee - $quantite_livree;
 258            
 259          if ($conf->stock->enabled)
 260          {
 261              $stock = $product->stock_entrepot[$_GET["entrepot_id"]];
 262              $stock+=0;  // Convertit en numérique
 263              
 264              // Quantité à livrer
 265              print '<td align="center">';
 266              print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
 267              print '<input name="qtyl'.$i.'" type="text" size="6" value="'.min($quantite_a_livrer, $stock).'">';
 268              print '</td>';
 269          
 270              // Stock
 271              if ($stock < $quantite_a_livrer)
 272              {
 273                  print '<td align="center" class="alerte">'.$stock.'</td>';
 274              }
 275              else
 276              {
 277                  print '<td align="center">'.$stock.'</td>';
 278              }
 279          }
 280          else
 281          {
 282              // Quantité à livrer
 283              print '<td align="center">';
 284              print '<input name="idl'.$i.'" type="hidden" value="'.$ligne->id.'">';
 285              print '<input name="qtyl'.$i.'" type="text" size="6" value="'.$quantite_a_livrer.'">';
 286              print '</td>';
 287          }
 288  
 289        print "</tr>\n";
 290        
 291        $i++;
 292        $var=!$var;
 293      }          
 294  
 295        /*
 296         *
 297         */
 298  
 299        print '<tr><td align="center" colspan="4"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
 300        print "</table>";
 301        print '</form>';
 302      } 
 303    else 
 304      {
 305        dolibarr_print_error($db);
 306      }
 307  } 
 308  else 
 309  /* *************************************************************************** */
 310  /*                                                                             */
 311  /* Mode vue et edition                                                         */
 312  /*                                                                             */
 313  /* *************************************************************************** */
 314  {  
 315      if ($_GET["id"] > 0)
 316      {
 317          $expedition = New Expedition($db);
 318          $result = $expedition->fetch($_GET["id"]);
 319      
 320          if ( $expedition->id > 0)
 321          {
 322              $author = new User($db);
 323              $author->id = $expedition->user_author_id;
 324              $author->fetch();
 325      
 326              llxHeader('','Fiche expedition','ch-expedition.html',$form_search,$author);
 327      
 328              $commande = New Commande($db);
 329              $commande->fetch($expedition->commande_id);
 330      
 331              $soc = new Societe($db);
 332              $soc->fetch($commande->soc_id);
 333      
 334              $h=0;
 335              $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$expedition->id;
 336              $head[$h][1] = $langs->trans("SendingCard");
 337              $hselected = $h;
 338              $h++;
 339      
 340              dolibarr_fiche_head($head, $hselected, $langs->trans("Sending"));
 341      
 342              /*
 343              * Confirmation de la suppression
 344              *
 345              */
 346              if ($_GET["action"] == 'delete')
 347              {
 348                  $html->form_confirm("fiche.php?id=$expedition->id","Supprimer l'expedition","Etes-vous sûr de vouloir supprimer cette expedition ?","confirm_delete");
 349                  print '<br>';
 350              }
 351      
 352              /*
 353              * Confirmation de la validation
 354              *
 355              */
 356              if ($_GET["action"] == 'valid')
 357              {
 358                  $html->form_confirm("fiche.php?id=$expedition->id","Valider l'expédition","Etes-vous sûr de vouloir valider cette expédition ?","confirm_valid");
 359                  print '<br>';
 360              }
 361              /*
 362              * Confirmation de l'annulation
 363              *
 364              */
 365              if ($_GET["action"] == 'annuler')
 366              {
 367                  $html->form_confirm("fiche.php?id=$expedition->id",$langs->trans("Cancel"),"Etes-vous sûr de vouloir annuler cette commande ?","confirm_cancel");
 368                  print '<br>';
 369              }
 370      
 371              /*
 372              *   Commande
 373              */
 374              if ($commande->brouillon == 1 && $user->rights->commande->creer)
 375              {
 376                  print '<form action="fiche.php?id='.$expedition->id.'" method="post">';
 377                  print '<input type="hidden" name="action" value="setremise">';
 378              }
 379      
 380              print '<table class="border" width="100%">';
 381      
 382              // Ref
 383              print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
 384              print '<td colspan="3">'.$expedition->ref.'</td></tr>';
 385      
 386              // Client
 387              print '<tr><td width="20%">'.$langs->trans("Customer").'</td>';
 388              print '<td width="30%">';
 389              print '<b><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></b></td>';
 390      
 391              // Auteur
 392              print '<td width="20%">'.$langs->trans("Author").'</td><td width="30%">'.$author->fullname.'</td>';
 393      
 394              print "</tr>";
 395      
 396              // Commande liée
 397              print '<tr><td>'.$langs->trans("Order").'</td>';
 398              print '<td><a href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id.'">'.$commande->ref."</a></td>\n";
 399              print '<td>&nbsp;</td><td>&nbsp;</td></tr>';
 400      
 401              // Date
 402              print '<tr><td>'.$langs->trans("Date").'</td>';
 403              print "<td>".strftime("%A %d %B %Y",$expedition->date)."</td>\n";
 404      
 405              // Entrepot
 406              $entrepot = new Entrepot($db);
 407              $entrepot->fetch($expedition->entrepot_id);
 408              print '<td width="20%">'.$langs->trans("Warehouse").'</td><td><a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?id='.$entrepot->id.'">'.$entrepot->libelle.'</a></td></tr>';
 409      
 410              print "</table>\n";
 411      
 412              /*
 413               * Lignes produits
 414               */
 415              echo '<br><table class="noborder" width="100%">';
 416      
 417              $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande";
 418              $sql .= " , ed.qty as qty_livre";
 419              $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd , ".MAIN_DB_PREFIX."expeditiondet as ed";
 420              $sql .= " WHERE ed.fk_expedition = $expedition->id AND cd.rowid = ed.fk_commande_ligne ";
 421      
 422              $resql = $db->query($sql);
 423      
 424              if ($resql)
 425              {
 426                  $num_prod = $db->num_rows($resql);
 427                  $i = 0;
 428      
 429                  print '<tr class="liste_titre">';
 430                  print '<td width="54%">'.$langs->trans("Products").'</td>';
 431                  print '<td align="center">Quan. commandée</td>';
 432                  print '<td align="center">Quan. livrée</td>';
 433                  print "</tr>\n";
 434      
 435                  $var=true;
 436                  while ($i < $num_prod)
 437                  {
 438                      $objp = $db->fetch_object($resql);
 439      
 440                      $var=!$var;
 441                      print "<tr $bc[$var]>";
 442                      if ($objp->fk_product > 0)
 443                      {
 444                          $product = new Product($db);
 445                          $product->fetch($objp->fk_product);
 446      
 447                          print '<td>';
 448                          print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
 449                          if ($objp->description) print nl2br($objp->description);
 450                          print '</td>';
 451                      }
 452                      else
 453                      {
 454                          print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
 455                      }
 456                      print '<td align="center">'.$objp->qty_commande.'</td>';
 457                      print '<td align="center">'.$objp->qty_livre.'</td>';
 458      
 459                      print "</tr>";
 460      
 461                      $i++;
 462                      $var=!$var;
 463                  }
 464                  $db->free($resql);
 465              }
 466              else
 467              {
 468                  dolibarr_print_error($db);
 469              }
 470      
 471              print "</table>\n";
 472      
 473              print "\n</div>\n";
 474      
 475      
 476              /*
 477              *    Boutons actions
 478              */
 479      
 480              if ($user->societe_id == 0)
 481              {
 482                  print '<div class="tabsAction">';
 483      
 484                  if ($expedition->statut == 0 && $user->rights->expedition->valider && $num_prod > 0)
 485                  {
 486                      print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=valid">'.$langs->trans("Validate").'</a>';
 487                  }
 488      
 489                  print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=pdf">'.$langs->trans('BuildPDF').'</a>';
 490      
 491                  if ($expedition->brouillon && $user->rights->expedition->supprimer)
 492                  {
 493                      print '<a class="butActionDelete" href="fiche.php?id='.$expedition->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
 494                  }
 495      
 496                  print '</div>';
 497              }
 498      
 499      
 500              /*
 501               * Documents générés
 502               */
 503              $filename=sanitize_string($expedition->id);
 504              $filedir=$conf->expedition->dir_output . "/" .get_exdir($expedition->id);
 505              $urlsource=$_SERVER["PHP_SELF"]."?id=".$expedition->id;
 506              //$genallowed=$user->rights->expedition->creer;
 507              //$delallowed=$user->rights->expedition->supprimer;
 508              $genallowed=0;
 509              $delallowed=0;
 510      
 511              $var=true;
 512      
 513              print "<br>\n";
 514      
 515              $html->show_documents('expedition',$filename,$filedir,$urlsource,$genallowed,$delallowed,$expedition->modelpdf);
 516      
 517      
 518              /*
 519               * Déjà livre
 520               */
 521              $sql = "SELECT cd.fk_product, cd.description, cd.rowid, cd.qty as qty_commande";
 522              $sql .= " , ed.qty as qty_livre, e.ref, ed.fk_expedition as expedition_id";
 523              $sql .= ",".$db->pdate("e.date_expedition")." as date_expedition";
 524              $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
 525              $sql .= " , ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."expedition as e";
 526              $sql .= " WHERE cd.fk_commande = ".$expedition->commande_id;
 527              $sql .= " AND e.rowid <> ".$expedition->id;
 528              $sql .= " AND cd.rowid = ed.fk_commande_ligne";
 529              $sql .= " AND ed.fk_expedition = e.rowid";
 530              $sql .= " AND e.fk_statut > 0";
 531              $sql .= " ORDER BY cd.fk_product";
 532      
 533              $resql = $db->query($sql);
 534              if ($resql)
 535              {
 536                  $num = $db->num_rows($resql);
 537                  $i = 0;
 538      
 539                  if ($num)
 540                  {
 541                      print '<br>';
 542      
 543                      print_titre($langs->trans("OtherSendingsForSameOrder"));
 544                      print '<table class="liste" width="100%">';
 545                      print '<tr class="liste_titre">';
 546                      print '<td width="54%">'.$langs->trans("Description").'</td>';
 547                      print '<td align="center">Quan. livrée</td>';
 548                      print '<td align="center">'.$langs->trans("Sending").'</td>';
 549                      print '<td align="center">'.$langs->trans("Date").'</td>';
 550                      print "</tr>\n";
 551      
 552                      $var=True;
 553                      while ($i < $num)
 554                      {
 555                          $var=!$var;
 556                          $objp = $db->fetch_object($resql);
 557                          print "<tr $bc[$var]>";
 558                          if ($objp->fk_product > 0)
 559                          {
 560                              $product = new Product($db);
 561                              $product->fetch($objp->fk_product);
 562      
 563                              print '<td>';
 564                              print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
 565                              if ($objp->description) print nl2br($objp->description);
 566                              print '</td>';
 567                          }
 568                          else
 569                          {
 570                              print "<td>".stripslashes(nl2br($objp->description))."</td>\n";
 571                          }
 572                          print '<td align="center">'.$objp->qty_livre.'</td>';
 573                          print '<td align="center"><a href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->ref.'<a></td>';
 574                          print '<td align="center">'.dolibarr_print_date($objp->date_expedition).'</td>';
 575                          $i++;
 576                      }
 577      
 578                      print '</table>';
 579                  }
 580                  $db->free($resql);
 581              }
 582              else {
 583                  dolibarr_print_error($db);
 584              }
 585      
 586              /*
 587              * Documents générés
 588              *
 589              */
 590              $file = $conf->commande->dir_output . "/" . $commande->ref . "/" . $commande->ref . ".pdf";
 591              $relativepath = $commande->ref . "/" . $commande->ref . ".pdf";
 592      
 593              $var=true;
 594      
 595              if (file_exists($file))
 596              {
 597                  print "<table width=\"100%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
 598                  print_titre("Documents");
 599                  print '<table width="100%" class="border">';
 600      
 601                  print "<tr $bc[$true]><td>".$langs->trans("Order")." PDF</td>";
 602                  print '<td><a href="'.DOL_URL_ROOT.'/document.php?modulepart=commande&file='.urlencode($relativepath).'">'.$commande->ref.'.pdf</a></td>';
 603                  print '<td align="right">'.filesize($file). ' bytes</td>';
 604                  print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
 605                  print '</tr>';
 606      
 607                  print "</table>\n";
 608                  print '</td><td valign="top" width="50%">';
 609                  print_titre("Actions");
 610                  /*
 611                  * Liste des actions
 612                  *
 613                  */
 614                  $sql = "SELECT ".$db->pdate("a.datea")." as da,  a.note";
 615                  $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
 616                  $sql .= " WHERE a.fk_soc = $commande->socidp AND a.fk_action in (9,10)";
 617                  $sql .= " AND a.fk_commande = $expedition->id";
 618      
 619                  $resql = $db->query($sql);
 620                  if ($resql)
 621                  {
 622                      $num = $db->num_rows($resql);
 623                      if ($num)
 624                      {
 625                          $i = 0;
 626                          print '<table class="border" width="100%">';
 627                          print "<tr $bc[$var]><td>".$langs->trans("Date")."</td><td>".$langs->trans("Action")."</td></tr>\n";
 628      
 629                          $var=True;
 630                          while ($i < $num)
 631                          {
 632                              $objp = $db->fetch_object($resql);
 633                              $var=!$var;
 634                              print "<tr $bc[$var]>";
 635                              print "<td>".strftime("%d %B %Y",$objp->da)."</td>\n";
 636                              print '<td>'.stripslashes($objp->note).'</td>';
 637                              print "</tr>";
 638                              $i++;
 639                          }
 640                          print "</table>";
 641                      }
 642                      $db->free($resql);
 643                  }
 644                  else
 645                  {
 646                      dolibarr_print_error($db);
 647                  }
 648      
 649                  /*
 650                  *
 651                  *
 652                  */
 653                  print "</td></tr></table>";
 654              }
 655              /*
 656              *
 657              *
 658              */
 659      
 660              if ($action == 'presend')
 661              {
 662                  $replytoname = $user->fullname;
 663                  $from_name = $replytoname;
 664      
 665                  $replytomail = $user->email;
 666                  $from_mail = $replytomail;
 667      
 668                  print "<form method=\"post\" action=\"fiche.php?id=$expedition->id&amp;action=send\">\n";
 669                  print '<input type="hidden" name="replytoname" value="'.$replytoname.'">';
 670                  print '<input type="hidden" name="replytomail" value="'.$replytomail.'">';
 671      
 672                  print "<p><b>Envoyer la commande par mail</b>";
 673                  print "<table cellspacing=0 border=1 cellpadding=3>";
 674                  print '<tr><td>Destinataire</td><td colspan="5">';
 675      
 676                  $form = new Form($db);
 677                  $form->select_array("destinataire",$soc->contact_email_array());
 678      
 679                  print "</td><td><input size=\"30\" name=\"sendto\" value=\"$commande->email\"></td></tr>";
 680                  print "<tr><td>Expéditeur</td><td colspan=\"5\">$from_name</td><td>$from_mail</td></tr>";
 681                  print "<tr><td>Reply-to</td><td colspan=\"5\">$replytoname</td>";
 682                  print "<td>$replytomail</td></tr></table>";
 683      
 684                  print "<input type=\"submit\" value=\"Envoyer\"></form>";
 685              }
 686          }
 687          else
 688          {
 689              /* Expedition non trouvée */
 690              llxHeader('','Fiche expedition','ch-expedition.html',$form_search);
 691              print "Expedition inexistante ou accés refusé";
 692          }
 693      }
 694      else
 695      {
 696          /* Expedition non trouvée */
 697          llxHeader('','Fiche expedition','ch-expedition.html',$form_search);
 698          print "Expedition inexistante ou accés refusé";
 699      }
 700  }
 701  
 702  $db->close();
 703  
 704  llxFooter('$Date: 2006/01/14 13:43:08 $ - $Revision: 1.29.2.2 $');
 705  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics