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


From: Regis Houssin
Subject: [Dolibarr-cvs] dolibarr/htdocs commandecommande.class.php expe...
Date: Wed, 07 Jun 2006 19:13:45 +0000

CVSROOT:        /cvsroot/dolibarr
Module name:    dolibarr
Changes by:     Regis Houssin <hregis>  06/06/07 19:13:45

Modified files:
        htdocs/commande: commande.class.php 
        htdocs/expedition: expedition.class.php fiche.php 
        htdocs/livraison: fiche.php livraison.class.php 

Log message:
        Ajout suppression des pdf provisoire si on supprime la commande, le 
bordereau d'expédition
         ou le bon de livraison avant sa validation

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/commande/commande.class.php?cvsroot=dolibarr&r1=1.146&r2=1.147
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/expedition/expedition.class.php?cvsroot=dolibarr&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/expedition/fiche.php?cvsroot=dolibarr&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/livraison/fiche.php?cvsroot=dolibarr&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/livraison/livraison.class.php?cvsroot=dolibarr&r1=1.36&r2=1.37

Patches:
Index: commande/commande.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -b -r1.146 -r1.147
--- commande/commande.class.php 5 Jun 2006 23:04:13 -0000       1.146
+++ commande/commande.class.php 7 Jun 2006 19:13:45 -0000       1.147
@@ -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.146 2006/06/05 23:04:13 eldy Exp $
+ * $Id: commande.class.php,v 1.147 2006/06/07 19:13:45 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.146 $
+        \version    $Revision: 1.147 $
 */
 
 require_once(DOL_DOCUMENT_ROOT."/product.class.php");
@@ -1845,6 +1845,8 @@
        */
        function delete()
        {
+               global $conf, $lang;
+               
                $err = 0;
                $this->db->begin();
                $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE 
fk_commande = $this->id ;";
@@ -1865,6 +1867,30 @@
                        $err++;
                }
 
+               // On efface le répertoire de pdf provisoire
+               $comref = sanitize_string($this->ref);
+               if ($conf->commande->dir_output)
+               {
+                               $dir = $conf->commande->dir_output . "/" . 
$comref ;
+                               $file = $conf->commande->dir_output . "/" . 
$comref . "/" . $comref . ".pdf";
+                               if (file_exists($file))
+                               {
+                                       if (!dol_delete_file($file))
+                                       {
+              $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
+              return 0;
+           }
+        }
+        if (file_exists($dir))
+        {
+               if (!dol_delete_dir($dir))
+          {
+               $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
+              return 0;
+          }
+        }
+     }
+
                if ($err == 0)
                {
                        $this->db->commit();

Index: expedition/expedition.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/expedition/expedition.class.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- expedition/expedition.class.php     3 Jun 2006 23:53:12 -0000       1.34
+++ expedition/expedition.class.php     7 Jun 2006 19:13:45 -0000       1.35
@@ -15,7 +15,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: expedition.class.php,v 1.34 2006/06/03 23:53:12 eldy Exp $
+ * $Id: expedition.class.php,v 1.35 2006/06/07 19:13:45 hregis Exp $
  * $Source: 
/cvsroot/dolibarr/dolibarr/htdocs/expedition/expedition.class.php,v $
  *
  */
@@ -24,7 +24,7 @@
         \file       htdocs/expedition/expedition.class.php
         \ingroup    expedition
         \brief      Fichier de la classe de gestion des expeditions
-        \version    $Revision: 1.34 $
+        \version    $Revision: 1.35 $
 */
 
 
@@ -521,6 +521,31 @@
        if ( $this->db->query($sql) ) 
          {
            $this->db->commit();
+           
+           // On efface le répertoire de pdf provisoire
+               $expref = sanitize_string($this->ref);
+               if ($conf->expedition->dir_output)
+               {
+                               $dir = $conf->expedition->dir_output . "/" . 
$expref ;
+                               $file = $conf->expedition->dir_output . "/" . 
$expref . "/" . $expref . ".pdf";
+                               if (file_exists($file))
+                               {
+                                       if (!dol_delete_file($file))
+                                       {
+              $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
+              return 0;
+           }
+        }
+        if (file_exists($dir))
+        {
+               if (!dol_delete_dir($dir))
+          {
+               $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
+              return 0;
+          }
+        }
+     }
+           
            return 1;
          }
        else

Index: expedition/fiche.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/expedition/fiche.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- expedition/fiche.php        3 Jun 2006 23:53:12 -0000       1.50
+++ expedition/fiche.php        7 Jun 2006 19:13:45 -0000       1.51
@@ -17,7 +17,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.50 2006/06/03 23:53:12 eldy Exp $
+ * $Id: fiche.php,v 1.51 2006/06/07 19:13:45 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/expedition/fiche.php,v $
  */
 
@@ -27,7 +27,7 @@
         \file       htdocs/expedition/fiche.php
         \ingroup    expedition
         \brief      Fiche descriptive d'une expedition
-        \version    $Revision: 1.50 $
+        \version    $Revision: 1.51 $
 */
 
 require("./pre.inc.php");
@@ -123,7 +123,7 @@
   if ($user->rights->expedition->supprimer ) 
     {
       $expedition = new Expedition($db);
-      $expedition->id = $_GET["id"];
+      $expedition->fectch($_GET["id"]);
       $expedition->delete();
       Header("Location: liste.php");
     }
@@ -722,5 +722,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2006/06/03 23:53:12 $ - $Revision: 1.50 $');
+llxFooter('$Date: 2006/06/07 19:13:45 $ - $Revision: 1.51 $');
 ?>

Index: livraison/fiche.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/livraison/fiche.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- livraison/fiche.php 1 Jun 2006 10:30:47 -0000       1.20
+++ livraison/fiche.php 7 Jun 2006 19:13:45 -0000       1.21
@@ -17,7 +17,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.20 2006/06/01 10:30:47 hregis Exp $
+ * $Id: fiche.php,v 1.21 2006/06/07 19:13:45 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/livraison/fiche.php,v $
  */
 
@@ -27,7 +27,7 @@
         \file       htdocs/livraison/fiche.php
         \ingroup    livraison
         \brief      Fiche descriptive d'un bon de livraison
-        \version    $Revision: 1.20 $
+        \version    $Revision: 1.21 $
 */
 
 require("./pre.inc.php");
@@ -121,7 +121,7 @@
   if ($user->rights->expedition->livraison->supprimer ) 
     {
       $livraison = new Livraison($db);
-      $livraison->id = $_GET["id"];
+      $livraison->fetch($_GET["id"]);
       $expedition_id = $_GET["expid"];
       $livraison->delete();
       if ($conf->expedition->enabled)
@@ -745,5 +745,5 @@
 
 $db->close();
 
-llxFooter('$Date: 2006/06/01 10:30:47 $ - $Revision: 1.20 $');
+llxFooter('$Date: 2006/06/07 19:13:45 $ - $Revision: 1.21 $');
 ?>

Index: livraison/livraison.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/livraison/livraison.class.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- livraison/livraison.class.php       31 May 2006 21:39:57 -0000      1.36
+++ livraison/livraison.class.php       7 Jun 2006 19:13:45 -0000       1.37
@@ -16,7 +16,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: livraison.class.php,v 1.36 2006/05/31 21:39:57 eldy Exp $
+ * $Id: livraison.class.php,v 1.37 2006/06/07 19:13:45 hregis Exp $
  * $Source: /cvsroot/dolibarr/dolibarr/htdocs/livraison/livraison.class.php,v $
  *
  */
@@ -25,7 +25,7 @@
         \file       htdocs/livraison/livraison.class.php
         \ingroup    livraison
         \brief      Fichier de la classe de gestion des bons de livraison
-        \version    $Revision: 1.36 $
+        \version    $Revision: 1.37 $
 */
 
 
@@ -521,6 +521,31 @@
        if ( $this->db->query($sql) ) 
          {
            $this->db->commit();
+           
+             // On efface le répertoire de pdf provisoire
+               $livref = sanitize_string($this->ref);
+               if ($conf->livraison->dir_output)
+               {
+                               $dir = $conf->livraison->dir_output . "/" . 
$livref ;
+                               $file = $conf->livraison->dir_output . "/" . 
$livref . "/" . $livref . ".pdf";
+                               if (file_exists($file))
+                               {
+                                       if (!dol_delete_file($file))
+                                       {
+              $this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
+              return 0;
+           }
+        }
+        if (file_exists($dir))
+        {
+               if (!dol_delete_dir($dir))
+          {
+               $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
+              return 0;
+          }
+        }
+     }
+           
            return 1;
          }
        else




reply via email to

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