From 5fcdcc206f52d7804481d6d56ebf2076a4b229cd Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sun, 14 Aug 2005 01:25:05 +0000
Subject: [PATCH] =?UTF-8?q?Ajoute=20bouton=20reg=E9n=E9rer=20propale?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/comm/propal.php   | 150 ++++++++++++++++++++-------------------
 htdocs/compta/propal.php |   2 +-
 2 files changed, 78 insertions(+), 74 deletions(-)

diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index d13b4fc22a7..2840815609f 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -619,8 +619,7 @@ if ($_GET['propalid'])
 	  if ($resql) 
 	    {
 	      $num_lignes = $db->num_rows($resql);
-	      $i = 0;
-	      $total = 0;
+                $i = 0; $total = 0;
 
 	      print '<table class="noborder" width="100%">';
 	      if ($num_lignes)
@@ -640,17 +639,17 @@ if ($_GET['propalid'])
 		{
 		  $objp = $db->fetch_object($resql);
 		  $var=!$var;
-		  if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid)
+		  
+			// Update ligne de propale
+			if ($_GET['action'] != 'editline' || $_GET['rowid'] != $objp->rowid)
 		    {
 		      print '<tr '.$bc[$var].'>';
 		      if ($objp->fk_product > 0)
               {
                 print '<td><a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
-                if ($objp->fk_product_type)
-                print img_object($langs->trans('ShowService'),'service');
-                else
-                print img_object($langs->trans('ShowProduct'),'product');
-                print ' '.stripslashes(nl2br($objp->product)).'</a>';
+                if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
+                else print img_object($langs->trans('ShowProduct'),'product');
+                print ' '.$objp->ref.'</a> - '.stripslashes(nl2br($objp->product));
                 if ($objp->date_start && $objp->date_end)
                 {
                     print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
@@ -712,6 +711,7 @@ if ($_GET['propalid'])
 			}
 		      print '</tr>';
 		    }
+
 		  // Update ligne de propal
 		  if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] == 'editline' && $_GET["ligne"] == $objp->rowid)
 		    {
@@ -722,7 +722,7 @@ if ($_GET['propalid'])
 		      print '<td colspan="2">&nbsp;</td>';
 		      print '<td align="right"><input name="subprice" type="text" size="6" value="'.$objp->subprice.'"></td>';
 		      print '<td align="right"><input name="qty" type="text" size="2" value="'.$objp->qty.'"></td>';
-		      print '<td align="right"><input name="remise" type="text" size="2" value="'.$objp->remise_percent.'"> %</td>';
+		      print '<td align="right" nowrap><input name="remise" type="text" size="2" value="'.$objp->remise_percent.'"> %</td>';
 		      print '<td align="center" colspan="3"><input type="submit" value="'.$langs->trans("Save").'"></td>';
 		      print '</tr></form>';
 		    }
@@ -739,7 +739,6 @@ if ($_GET['propalid'])
 
 	  /*
 	   * Ajouter une ligne
-	   *
 	   */
 	  if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] <> 'editline')
 	    {
@@ -826,71 +825,76 @@ if ($_GET['propalid'])
     }
 
 
-  /*
-   * Boutons Actions
-   */
-  if ($propal->statut < 2)
+    /*
+     * Boutons Actions
+     */
+    print '<div class="tabsAction">';
+    
+    // Valid
+    if ($propal->statut == 0)
     {
-      print '<div class="tabsAction">';
-
-      // Valid
-      if ($propal->statut == 0)
-	{
-	  if ($user->rights->propale->valider)
-	    {
-	      print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;valid=1">'.$langs->trans('Valid').'</a>';
-	    }
-	}
-
-      // Save
-      if ($propal->statut == 1)
-	{
-	  if ($user->rights->propale->creer)
-	    {
-	      print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=modif">'.$langs->trans('Edit').'</a>';
-	    }
-	}
-
-      // Build PDF
-      if ($propal->statut < 2 && $user->rights->propale->creer)
-	{
-	  print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=pdf">'.$langs->trans('BuildPDF').'</a>';
-	}	   
-
-      // Send
-      if ($propal->statut == 1)
-	{
-	  if ($user->rights->propale->envoyer)
-	    {
-	      $propref = sanitize_string($obj->ref);
-	      $file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
-	      if (file_exists($file))
-		{
-		  print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=presend">'.$langs->trans('Send').'</a>';
-		}
-	    }
-	}
-
-      // Close
-      if ($propal->statut != 0)
-	{
-	  if ($propal->statut == 1 && $user->rights->propale->cloturer)
-	    {
-	      print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=statut">'.$langs->trans('Close').'</a>';
-	    }
-	}
-
-      // Delete
-      if ($propal->statut == 0)
-	{
-	  if ($user->rights->propale->supprimer)
-	    {
-	      print '<a class="butActionDelete" href="propal.php?propalid='.$propal->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
-	    }
-	}
-
-      print '</div>';
+        if ($user->rights->propale->valider)
+        {
+            print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;valid=1">'.$langs->trans('Valid').'</a>';
+        }
     }
+    
+    // Save
+    if ($propal->statut == 1)
+    {
+        if ($user->rights->propale->creer)
+        {
+            print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=modif">'.$langs->trans('Edit').'</a>';
+        }
+    }
+    
+    // Build PDF
+    if ($user->rights->propale->creer)
+    {
+        if ($propal->statut < 2)
+        {
+            print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=pdf">'.$langs->trans("BuildPDF").'</a>';
+        }
+        else
+        {
+            print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=pdf">'.$langs->trans("RebuildPDF").'</a>';
+        }
+    }
+    
+    // Send
+    if ($propal->statut == 1)
+    {
+        if ($user->rights->propale->envoyer)
+        {
+            $propref = sanitize_string($obj->ref);
+            $file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
+            if (file_exists($file))
+            {
+                print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=presend">'.$langs->trans('Send').'</a>';
+            }
+        }
+    }
+    
+    // Close
+    if ($propal->statut != 0)
+    {
+        if ($propal->statut == 1 && $user->rights->propale->cloturer)
+        {
+            print '<a class="butAction" href="propal.php?propalid='.$propal->id.'&amp;action=statut">'.$langs->trans('Close').'</a>';
+        }
+    }
+    
+    // Delete
+    if ($propal->statut == 0)
+    {
+        if ($user->rights->propale->supprimer)
+        {
+            print '<a class="butActionDelete" href="propal.php?propalid='.$propal->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
+        }
+    }
+    
+    print '</div>';
+
 
 
   print '<table width="100%"><tr><td width="50%" valign="top">';
diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php
index 53417cbf170..c985fc85caf 100644
--- a/htdocs/compta/propal.php
+++ b/htdocs/compta/propal.php
@@ -354,7 +354,7 @@ if ($_GET["propalid"])
 			    print img_object($langs->trans('ShowService'),'service');
 			  else 
 			    print img_object($langs->trans('ShowProduct'),'product');
-                print ' '.stripslashes(nl2br($objp->product)).'</a>';
+                print ' '.$objp->ref.'</a> - '.stripslashes(nl2br($objp->product));
 			  if ($objp->date_start && $objp->date_end) 
 			    {
 			      print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
-- 
GitLab