/[dolibarr]/dolibarr/htdocs/comm/propal.php
ViewVC logotype

Diff of /dolibarr/htdocs/comm/propal.php

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

revision 1.119 by eldy, Thu Aug 25 20:27:17 2005 UTC revision 1.120 by eldy, Thu Sep 1 19:28:15 2005 UTC
# Line 72  $form=new Form($db); Line 72  $form=new Form($db);
72    
73  if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')  if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
74  {  {
75    if ($user->rights->propale->supprimer)      if ($user->rights->propale->supprimer)
76      {      {
77        $propal = new Propal($db, 0, $_GET['propalid']);          $propal = new Propal($db, 0, $_GET['propalid']);
78        $propal->delete($user);          $propal->delete($user);
79        $propalid = 0;          $propalid = 0;
80        $brouillon = 1;          $brouillon = 1;
81      }      }
82    Header('Location: propal.php');      Header('Location: propal.php');
83  }  }
84    
85    if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes')
86    {
87        if ($user->rights->propale->valider)
88        {
89            $propal = new Propal($db);
90            $propal->fetch($_GET['propalid']);
91            $propal->update_price($_GET['propalid']);
92            propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);
93            $propal->valid($user);
94        }
95        Header ('Location: propal.php?propalid='.$_GET['propalid']);
96    }
97    
98  if ($_POST['action'] == 'add')  if ($_POST['action'] == 'add')
99  {  {
# Line 289  if ($_POST['action'] == "addligne" && $u Line 301  if ($_POST['action'] == "addligne" && $u
301      propale_pdf_create($db, $_POST['propalid'], $propal->modelpdf);      propale_pdf_create($db, $_POST['propalid'], $propal->modelpdf);
302  }  }
303    
304  if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer)  if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save"))
305  {  {
306    /*      /*
307     *  Mise à jour d'une ligne dans la propale       *  Mise à jour d'une ligne dans la propale
308     */       */
309        $propal = new Propal($db);
310    $propal = new Propal($db);      $propal->fetch($_GET['propalid']);
311    $propal->fetch($_GET['propalid']);      $propal->UpdateLigne($_POST['ligne'], $_POST['subprice'], $_POST['qty'], $_POST['remise_percent'], $_POST['tva_tx'], $_POST['desc']);
312    $propal->UpdateLigne($_POST['ligne'], $_POST['subprice'], $_POST['qty'], $_POST['remise']);      propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);
   
   propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);  
313  }  }
314    
315  if ($_POST['action'] == 'setpdfmodel' && $user->rights->propale->creer)  if ($_POST['action'] == 'setpdfmodel' && $user->rights->propale->creer)
316  {  {
317    $propal = new Propal($db, 0, $_GET['propalid']);      $propal = new Propal($db, 0, $_GET['propalid']);
318    $propal->set_pdf_model($user, $_POST['modelpdf']);      $propal->set_pdf_model($user, $_POST['modelpdf']);
319    propale_pdf_create($db, $_GET['propalid'], $_POST['modelpdf']);      propale_pdf_create($db, $_GET['propalid'], $_POST['modelpdf']);
320  }  }
321    
322    
# Line 321  if ($_GET['action'] == 'del_ligne' && $u Line 331  if ($_GET['action'] == 'del_ligne' && $u
331    propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);    propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);
332  }  }
333    
 if ($_GET['valid'] == 1 && $user->rights->propale->valider)  
 {  
   $propal = new Propal($db);  
   $propal->fetch($_GET['propalid']);  
   $propal->update_price($_GET['propalid']);  
   propale_pdf_create($db, $_GET['propalid'], $propal->modelpdf);  
   $propal->valid($user);  
 }  
   
334  if ($_POST['action'] == 'setremise' && $user->rights->propale->creer)  if ($_POST['action'] == 'setremise' && $user->rights->propale->creer)
335  {  {
336    $propal = new Propal($db);    $propal = new Propal($db);
# Line 401  if ($_GET['propalid'] > 0) Line 402  if ($_GET['propalid'] > 0)
402    
403    /*    /*
404     * Confirmation de la suppression de la propale     * Confirmation de la suppression de la propale
    *  
405     */     */
406    if ($_GET['action'] == 'delete')    if ($_GET['action'] == 'delete')
407      {      {
# Line 409  if ($_GET['propalid'] > 0) Line 409  if ($_GET['propalid'] > 0)
409        print '<br>';        print '<br>';
410      }      }
411    
412      /*
413       * Confirmation de la validation de la propale
414       */
415      if ($_GET['action'] == 'validate')
416        {
417          $html->form_confirm('propal.php?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmvalidateProp'), 'confirm_validate');
418          print '<br>';
419        }
420    
421    
422    /*    /*
423     * Fiche propal     * Fiche propal
# Line 621  if ($_GET['propalid'] > 0) Line 630  if ($_GET['propalid'] > 0)
630                      print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';                      print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
631                      print '<td align="right" width="50">'.$langs->trans('Discount').'</td>';                      print '<td align="right" width="50">'.$langs->trans('Discount').'</td>';
632                      print '<td align="right" width="50">'.$langs->trans('AmountHT').'</td>';                      print '<td align="right" width="50">'.$langs->trans('AmountHT').'</td>';
633                      print '<td>&nbsp;</td><td>&nbsp;</td>';                      print '<td width="16">&nbsp;</td><td width="16">&nbsp;</td>';
634                      print "</tr>\n";                      print "</tr>\n";
635                  }                  }
636                  $var=true;                  $var=true;
# Line 630  if ($_GET['propalid'] > 0) Line 639  if ($_GET['propalid'] > 0)
639                      $objp = $db->fetch_object($resql);                      $objp = $db->fetch_object($resql);
640                      $var=!$var;                      $var=!$var;
641            
642                      // Update ligne de propale                      // Ligne en mode visu
643                      if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid)                      if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid)
644                      {                      {
645                          print '<tr '.$bc[$var].'>';                          print '<tr '.$bc[$var].'>';
646                          if ($objp->fk_product > 0)                          if ($objp->fk_product > 0)
# Line 639  if ($_GET['propalid'] > 0) Line 648  if ($_GET['propalid'] > 0)
648                              print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';                              print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
649                              if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');                              if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
650                              else print img_object($langs->trans('ShowProduct'),'product');                              else print img_object($langs->trans('ShowProduct'),'product');
651                              print ' '.$objp->ref.'</a> - '.stripslashes(nl2br($objp->product));                              print ' '.$objp->ref.'</a>';
652                                                            print ' - '.nl2br(stripslashes($objp->product));
653                              if ($objp->date_start && $objp->date_end)                              if ($objp->date_start && $objp->date_end)
654                              {                              {
655                                  print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';                                  print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
# Line 652  if ($_GET['propalid'] > 0) Line 662  if ($_GET['propalid'] > 0)
662                              {                              {
663                                  print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';                                  print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
664                              }                              }
665                              print ($objp->description && $objp->description!=$obj->product)?'<br>'.$objp->description:'';                              print ($objp->description && $objp->description!=$objp->product)?'<br>'.$objp->description:'';
666                              print '</td>';                              print '</td>';
667                          }                          }
668                          else                          else
# Line 702  if ($_GET['propalid'] > 0) Line 712  if ($_GET['propalid'] > 0)
712                          print '</tr>';                          print '</tr>';
713                      }                      }
714            
715                      // Update ligne de propal                      // Ligne en mode update
716                      if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] == 'editline' && $_GET["ligne"] == $objp->rowid)                      if ($propal->statut == 0 && $_GET["action"] == 'editline' && $user->rights->propale->creer && $_GET["ligne"] == $objp->rowid)
717                      {                      {
718                          print '<form action="propal.php?propalid='.$propal->id.'" method="post">';                          print '<form action="propal.php?propalid='.$propal->id.'" method="post">';
719                          print '<input type="hidden" name="action" value="updateligne">';                          print '<input type="hidden" name="action" value="updateligne">';
720                            print '<input type="hidden" name="propalid" value="'.$propal->id.'">';
721                          print '<input type="hidden" name="ligne" value="'.$_GET["ligne"].'">';                          print '<input type="hidden" name="ligne" value="'.$_GET["ligne"].'">';
722                          print '<tr '.$bc[$var].'>';                          print '<tr '.$bc[$var].'>';
723                          print '<td colspan="2">&nbsp;</td>';                          print '<td>';
724                          print '<td align="right"><input name="subprice" type="text" size="6" value="'.$objp->subprice.'"></td>';                          if ($objp->fk_product > 0)
725                          print '<td align="right"><input name="qty" type="text" size="2" value="'.$objp->qty.'"></td>';                          {
726                          print '<td align="right" nowrap><input name="remise" type="text" size="2" value="'.$objp->remise_percent.'"> %</td>';                              print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
727                          print '<td align="center" colspan="3"><input type="submit" value="'.$langs->trans("Save").'"></td>';                              if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
728                          print '</tr>';                              else print img_object($langs->trans('ShowProduct'),'product');
729                          print '</form>';                              print ' '.$objp->ref.'</a>';
730                                print ' - '.stripslashes(nl2br($objp->product));
731                                print '<br>';
732                            }
733                            print '<textarea name="desc" cols="50" rows="1">'.stripslashes($objp->description).'</textarea></td>';
734                            print '<td align="right">';
735                            print $html->select_tva("tva_tx",$objp->tva_tx);
736                            print '</td>';
737                            print '<td align="right"><input size="6" type="text" name="subprice" value="'.price($objp->subprice).'"></td>';
738                            print '<td align="right"><input size="2" type="text" name="qty" value="'.$objp->qty.'"></td>';
739                            print '<td align="right" nowrap><input size="2" type="text" name="remise_percent" value="'.$objp->remise_percent.'">%</td>';
740                            print '<td align="center" colspan="4" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
741                            print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
742                            print '</tr>' . "\n";
743                            /*
744                                                    if ($conf->service->enabled)
745                            {
746                                print "<tr $bc[$var]>";
747                                print '<td colspan="5">Si produit de type service à durée limitée: Du ';
748                                print $html->select_date($objp->date_start,"date_start",0,0,$objp->date_start?0:1);
749                                print ' au ';
750                                print $html->select_date($objp->date_end,"date_end",0,0,$objp->date_end?0:1);
751                                print '</td>';
752                                print '</tr>' . "\n";
753                            }
754                                                    */
755                            print "</form>\n";
756                      }                      }
757            
758                      $total = $total + ($objp->qty * $objp->price);                      $total = $total + ($objp->qty * $objp->price);
759                      $i++;                      $i++;
760                  }                  }
761                
762                  $db->free($resql);                  $db->free($resql);
763              }              }
764              else              else
# Line 811  if ($_GET['propalid'] > 0) Line 849  if ($_GET['propalid'] > 0)
849        print '<option value="3">'.$propal->labelstatut[3].'</option>';        print '<option value="3">'.$propal->labelstatut[3].'</option>';
850        print '</select>';        print '</select>';
851        print '</td></tr>';        print '</td></tr>';
852        print '<tr><td align="center" colspan="2"><input type="submit" value="'.$langs->trans('Valid').'"></td>';        print '<tr><td align="center" colspan="2"><input type="submit" value="'.$langs->trans('Validate').'"></td>';
853        print '</tr></table></form>';        print '</tr></table></form>';
854      }      }
855    
# Line 826  if ($_GET['propalid'] > 0) Line 864  if ($_GET['propalid'] > 0)
864      {      {
865          if ($user->rights->propale->valider)          if ($user->rights->propale->valider)
866          {          {
867              print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;valid=1">'.$langs->trans('Valid').'</a>';              print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=validate">'.$langs->trans('Validate').'</a>';
868          }          }
869      }      }
870            

Legend:
Removed from v.1.119  
changed lines
  Added in v.1.120

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