dolibarr-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-cvs] dolibarr/htdocs commandecommande.class.php comm...


From: Regis Houssin
Subject: [Dolibarr-cvs] dolibarr/htdocs commandecommande.class.php comm...
Date: Fri, 09 Jun 2006 14:38:20 +0000

CVSROOT:        /cvsroot/dolibarr
Module name:    dolibarr
Changes by:     Regis Houssin <hregis>  06/06/09 14:38:20

Modified files:
        htdocs/commande: commande.class.php fiche.php 
        htdocs/includes/modules/commande: modules_commande.php 

Log message:
        bugfix

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/commande/commande.class.php?cvsroot=dolibarr&r1=1.152&r2=1.153
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/commande/fiche.php?cvsroot=dolibarr&r1=1.195&r2=1.196
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/includes/modules/commande/modules_commande.php?cvsroot=dolibarr&r1=1.13&r2=1.14

Patches:
Index: commande/commande.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -b -r1.152 -r1.153
--- commande/commande.class.php 9 Jun 2006 12:45:52 -0000       1.152
+++ commande/commande.class.php 9 Jun 2006 14:38:19 -0000       1.153
@@ -18,7 +18,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: commande.class.php,v 1.152 2006/06/09 12:45:52 hregis Exp $
+ * $Id: commande.class.php,v 1.153 2006/06/09 14:38:19 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v $
  */
  
@@ -26,7 +26,7 @@
         \file       htdocs/commande/commande.class.php
         \ingroup    commande
         \brief      Fichier des classes de commandes
-        \version    $Revision: 1.152 $
+        \version    $Revision: 1.153 $
 */
 
 require_once(DOL_DOCUMENT_ROOT."/product.class.php");
@@ -41,6 +41,7 @@
 {
        var $db ;
        var $id ;
+       var $ref;
        var $socidp;
        var $contactid;
        var $projet_id;
@@ -1926,7 +1927,7 @@
                                $file = $conf->commande->dir_output . "/" . 
$comref . "/" . $comref . ".pdf";
                                if (file_exists($file))
                                {
-                                       commande_delete_preview($this->db, 
$this->id);
+                                       commande_delete_preview($this->db, 
$this->id, $this->ref);
                                        
                                        if (!dol_delete_file($file))
                                        {

Index: commande/fiche.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/commande/fiche.php,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -b -r1.195 -r1.196
--- commande/fiche.php  9 Jun 2006 13:21:47 -0000       1.195
+++ commande/fiche.php  9 Jun 2006 14:38:19 -0000       1.196
@@ -19,7 +19,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  *
- * $Id: fiche.php,v 1.195 2006/06/09 13:21:47 hregis Exp $
+ * $Id: fiche.php,v 1.196 2006/06/09 14:38:19 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/commande/fiche.php,v $
  */
 
@@ -27,7 +27,7 @@
        \file       htdocs/commande/fiche.php
        \ingroup    commande
        \brief      Fiche commande
-       \version    $Revision: 1.195 $
+       \version    $Revision: 1.196 $
 */
 
 require('./pre.inc.php');
@@ -287,7 +287,6 @@
        if ($user->rights->commande->supprimer )
        {
                $commande = new Commande($db);
-               //$commande->id = $_GET['id'];
                $commande->fetch($_GET['id']);
                $commande->delete();
                Header('Location: index.php');
@@ -1701,5 +1700,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2006/06/09 13:21:47 $ - $Revision: 1.195 $');
+llxFooter('$Date: 2006/06/09 14:38:19 $ - $Revision: 1.196 $');
 ?>

Index: includes/modules/commande/modules_commande.php
===================================================================
RCS file: 
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/commande/modules_commande.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- includes/modules/commande/modules_commande.php      9 Jun 2006 12:40:33 
-0000       1.13
+++ includes/modules/commande/modules_commande.php      9 Jun 2006 14:38:20 
-0000       1.14
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  * or see http://www.gnu.org/
  *
- * $Id: modules_commande.php,v 1.13 2006/06/09 12:40:33 hregis Exp $
+ * $Id: modules_commande.php,v 1.14 2006/06/09 14:38:20 hregis Exp $
  * $Source: 
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/commande/modules_commande.php,v
 $
  *
  */
@@ -29,7 +29,7 @@
                 \ingroup    commande
                 \brief      Fichier contenant la classe mère de generation des 
commandes en PDF
                             et la classe mère de numérotation des commandes
-                \version    $Revision: 1.13 $
+                \version    $Revision: 1.14 $
 */
 
 require_once(FPDF_PATH.'fpdf.php');
@@ -212,22 +212,36 @@
 }
 
 
-function commande_delete_preview($db, $commandeid)
+function commande_delete_preview($db, $commandeid, $commanderef='')
 {
         global $langs,$conf;
 
+        if (!$commanderef)
+        {
         $com = new Commande($db,"",$commandeid);
         $com->fetch($commandeid);  
-        $client = new Societe($db);
-        $client->fetch($com->soc_id);
+               $commanderef = $com->ref;
+        }
+        //$client = new Societe($db);
+        //$client->fetch($com->soc_id);
 
         if ($conf->commande->dir_output)
         {
-               $comref = sanitize_string($com->ref);
+               $comref = sanitize_string($commanderef);
                $dir = $conf->commande->dir_output . "/" . $comref ;
                $file = $dir . "/" . $comref . ".pdf.png";
                $multiple = $file . ".";
                
+               if ( file_exists( $file ) && is_writable( $file ) )
+               {
+                       if ( ! unlink($file) )
+                               {
+                                       
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
+                                       return 0;
+                               }
+               }
+               else
+               {
                for ($i = 0; $i < 20; $i++)
                {
                        $preview = $multiple.$i;
@@ -240,13 +254,6 @@
                                        return 0;
                                }
                        }
-                       else if ( file_exists( $file ) && is_writable( $file ) )
-                       {
-                               if ( ! unlink($file) )
-                               {
-                                       
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
-                                       return 0;
-                               }
                        }
                }
         }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]