[Top][All Lists]
[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 14:58:54 +0000 |
CVSROOT: /cvsroot/dolibarr
Module name: dolibarr
Changes by: Regis Houssin <hregis> 06/06/09 14:58:54
Modified files:
htdocs/commande: commande.class.php
htdocs/includes/modules/commande: modules_commande.php
htdocs/includes/modules/propale: modules_propale.php
htdocs : propal.class.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.153&r2=1.154
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/includes/modules/commande/modules_commande.php?cvsroot=dolibarr&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/includes/modules/propale/modules_propale.php?cvsroot=dolibarr&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/dolibarr/htdocs/propal.class.php?cvsroot=dolibarr&r1=1.135&r2=1.136
Patches:
Index: commande/commande.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/commande/commande.class.php,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -b -r1.153 -r1.154
--- commande/commande.class.php 9 Jun 2006 14:38:19 -0000 1.153
+++ commande/commande.class.php 9 Jun 2006 14:58:53 -0000 1.154
@@ -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.153 2006/06/09 14:38:19 hregis Exp $
+ * $Id: commande.class.php,v 1.154 2006/06/09 14:58:53 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.153 $
+ \version $Revision: 1.154 $
*/
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
@@ -182,7 +182,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: includes/modules/commande/modules_commande.php
===================================================================
RCS file:
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/commande/modules_commande.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- includes/modules/commande/modules_commande.php 9 Jun 2006 14:38:20
-0000 1.14
+++ includes/modules/commande/modules_commande.php 9 Jun 2006 14:58:54
-0000 1.15
@@ -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.14 2006/06/09 14:38:20 hregis Exp $
+ * $Id: modules_commande.php,v 1.15 2006/06/09 14:58:54 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.14 $
+ \version $Revision: 1.15 $
*/
require_once(FPDF_PATH.'fpdf.php');
@@ -211,7 +211,12 @@
}
}
-
+/**
+ \brief Supprime l'image de prévisualitation, pour le cas de
régénération de commande
+ \param db objet base de donnée
+ \param commandeid id de la commande à effacer
+ \param commanderef référence de la commande si besoin
+*/
function commande_delete_preview($db, $commandeid, $commanderef='')
{
global $langs,$conf;
@@ -222,8 +227,6 @@
$com->fetch($commandeid);
$commanderef = $com->ref;
}
- //$client = new Societe($db);
- //$client->fetch($com->soc_id);
if ($conf->commande->dir_output)
{
Index: includes/modules/propale/modules_propale.php
===================================================================
RCS file:
/cvsroot/dolibarr/dolibarr/htdocs/includes/modules/propale/modules_propale.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- includes/modules/propale/modules_propale.php 9 Jun 2006 12:40:33
-0000 1.21
+++ includes/modules/propale/modules_propale.php 9 Jun 2006 14:58:54
-0000 1.22
@@ -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.21 2006/06/09 12:40:33 hregis Exp $
+ * $Id: modules_propale.php,v 1.22 2006/06/09 14:58:54 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.21 $
+ \version $Revision: 1.22 $
*/
require_once(FPDF_PATH.'fpdf.php');
@@ -194,22 +194,36 @@
\brief Supprime l'image de prévisualitation, pour le cas de
régénération de propal
\param db objet base de donnée
\param propalid id de la propal à effacer
+ \param propalref référence de la propal si besoin
*/
-function propale_delete_preview($db, $propalid)
+function propale_delete_preview($db, $propalid, $propalref='')
{
global $langs,$conf;
+ if (!$propalref)
+ {
$propal = new Propal($db,"",$propalid);
$propal->fetch($propalid);
- $propal->fetch_client();
+ $propalref = $propal->ref;
+ }
if ($conf->propal->dir_output)
{
- $propalref = sanitize_string($propal->ref);
+ $propref = sanitize_string($propalref);
$dir = $conf->propal->dir_output . "/" . $propalref ;
$file = $dir . "/" . $propalref . ".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;
@@ -222,13 +236,6 @@
return 0;
}
}
- else if ( file_exists( $file ) && is_writable( $file ) )
- {
- if ( ! unlink($file) )
- {
-
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
- return 0;
- }
}
}
}
Index: propal.class.php
===================================================================
RCS file: /cvsroot/dolibarr/dolibarr/htdocs/propal.class.php,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- propal.class.php 5 Jun 2006 18:03:15 -0000 1.135
+++ propal.class.php 9 Jun 2006 14:58:54 -0000 1.136
@@ -20,7 +20,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: propal.class.php,v 1.135 2006/06/05 18:03:15 hregis Exp $
+ * $Id: propal.class.php,v 1.136 2006/06/09 14:58:54 hregis Exp $
* $Source: /cvsroot/dolibarr/dolibarr/htdocs/propal.class.php,v $
*/
@@ -30,7 +30,7 @@
\author Rodolphe Qiedeville
\author Eric Seigne
\author Laurent Destailleur
- \version $Revision: 1.135 $
+ \version $Revision: 1.136 $
*/
require_once(DOL_DOCUMENT_ROOT ."/product.class.php");
@@ -1478,12 +1478,41 @@
*/
function delete($user)
{
+ global $conf;
+
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal =
".$this->id;
if ( $this->db->query($sql) )
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id;
if ( $this->db->query($sql) )
{
+
+ // On efface le répertoire du pdf
+ $propalref =
sanitize_string($this->ref);
+ if
($conf->propal->dir_output)
+ {
+ $dir =
$conf->propal->dir_output . "/" . $propalref ;
+ $file =
$conf->propal->dir_output . "/" . $propalref . "/" . $propalref . ".pdf";
+ if
(file_exists($file))
+ {
+
propale_delete_preview($this->db, $this->id, $this->ref);
+
+ 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;
+ }
+ }
+ }
+
dolibarr_syslog("Suppression de la proposition $this->id par
$user->fullname ($user->id)");
return 1;
}