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 incl...


From: Regis Houssin
Subject: [Dolibarr-cvs] dolibarr/htdocs commandecommande.class.php incl...
Date: Fri, 09 Jun 2006 12:40:34 +0000

CVSROOT:        /cvsroot/dolibarr
Module name:    dolibarr
Changes by:     Regis Houssin <hregis>  06/06/09 12:40:33

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

Log message:
        Fix: les apercus en PNG n'était pas supprimé si il y avait plusieurs 
pages

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/commande/commande.class.php?cvsroot=dolibarr&r1=1.150&r2=1.151
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/includes/modules/commande/modules_commande.php?cvsroot=dolibarr&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/includes/modules/propale/modules_propale.php?cvsroot=dolibarr&r1=1.20&r2=1.21

Patches:
Index: commande/commande.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -b -r1.150 -r1.151
--- commande/commande.class.php 8 Jun 2006 15:53:39 -0000       1.150
+++ commande/commande.class.php 9 Jun 2006 12:40:33 -0000       1.151
@@ -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.150 2006/06/08 15:53:39 hregis Exp $
+ * $Id: commande.class.php,v 1.151 2006/06/09 12:40:33 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.150 $
+        \version    $Revision: 1.151 $
 */
 
 require_once(DOL_DOCUMENT_ROOT."/product.class.php");
@@ -181,6 +181,8 @@
                                                                $file = 
$conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
                                                                if 
(file_exists($file))
                                                                {
+                                                                       
commande_delete_preview($this->db, $this->id);
+                                                                       
                                                                        if 
(!dol_delete_file($file))
                                                                        {
                     $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);

Index: includes/modules/commande/modules_commande.php
===================================================================
RCS file: 
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/commande/modules_commande.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- includes/modules/commande/modules_commande.php      6 May 2006 21:09:26 
-0000       1.12
+++ includes/modules/commande/modules_commande.php      9 Jun 2006 12:40:33 
-0000       1.13
@@ -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.12 2006/05/06 21:09:26 eldy Exp $
+ * $Id: modules_commande.php,v 1.13 2006/06/09 12:40:33 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.12 $
+                \version    $Revision: 1.13 $
 */
 
 require_once(FPDF_PATH.'fpdf.php');
@@ -212,12 +212,12 @@
 }
 
 
-function commande_delete_preview($db, $propalid)
+function commande_delete_preview($db, $commandeid)
 {
         global $langs,$conf;
 
-        $com = new Commande($db,"",$propalid);
-        $com->fetch($propalid);  
+        $com = new Commande($db,"",$commandeid);
+        $com->fetch($commandeid);  
         $client = new Societe($db);
     $client->fetch($com->soc_id);
 
@@ -226,8 +226,21 @@
                 $comref = sanitize_string($com->ref); 
                 $dir = $conf->commande->dir_output . "/" . $comref ; 
                 $file = $dir . "/" . $comref . ".pdf.png";
+               $multiple = $file . ".";
 
-                if ( file_exists( $file ) && is_writable( $file ) )
+               for ($i = 0; $i < 20; $i++)
+               {
+                       $preview = $multiple.$i;
+                       
+                       if ( file_exists( $preview ) && is_writable( $preview ) 
)
+                       {
+                               if ( ! unlink($preview) )
+                               {
+                                       
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
+                                       return 0;
+                               }
+                       }
+                       else if ( file_exists( $file ) && is_writable( $file ) )
                         {
                         if ( ! unlink($file) )
                                 {
@@ -236,5 +249,6 @@
                                 }
                         }
                 }
+        }
 }
 ?>

Index: includes/modules/propale/modules_propale.php
===================================================================
RCS file: 
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/propale/modules_propale.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- includes/modules/propale/modules_propale.php        28 Apr 2006 22:54:02 
-0000      1.20
+++ includes/modules/propale/modules_propale.php        9 Jun 2006 12:40:33 
-0000       1.21
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  * or see http://www.gnu.org/
  *
- * $Id: modules_propale.php,v 1.20 2006/04/28 22:54:02 eldy Exp $
+ * $Id: modules_propale.php,v 1.21 2006/06/09 12:40:33 hregis Exp $
  * $Source: 
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/propale/modules_propale.php,v
 $
  */
 
@@ -26,7 +26,7 @@
                \ingroup    propale
                \brief      Fichier contenant la classe mère de generation des 
propales en PDF
                        et la classe mère de numérotation des propales
-               \version    $Revision: 1.20 $
+               \version    $Revision: 1.21 $
 */
 
 require_once(FPDF_PATH.'fpdf.php');
@@ -208,8 +208,21 @@
                $propalref = sanitize_string($propal->ref); 
                $dir = $conf->propal->dir_output . "/" . $propalref ; 
                $file = $dir . "/" . $propalref . ".pdf.png";
+      $multiple = $file . ".";
 
-               if ( file_exists( $file ) && is_writable( $file ) )
+               for ($i = 0; $i < 20; $i++)
+               {
+                       $preview = $multiple.$i;
+                       
+                       if ( file_exists( $preview ) && is_writable( $preview ) 
)
+                       {
+                               if ( ! unlink($preview) )
+                               {
+                                       
$this->error=$langs->trans("ErrorFailedToOpenFile",$preview);
+                                       return 0;
+                               }
+                       }
+                       else if ( file_exists( $file ) && is_writable( $file ) )
                        {
                        if ( ! unlink($file) )
                                {
@@ -218,5 +231,6 @@
                                }
                        }
                }
+        }
 }
 ?>




reply via email to

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