From b03b4685cf425cdd1e3486b4644920a1d2893db7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Dec 2007 21:05:32 +0000 Subject: [PATCH] Perf: On charge CMailFile que si besoin --- htdocs/adherents/adherent.class.php | 3 +-- htdocs/admin/mails.php | 3 +-- htdocs/comm/mailing/fiche.php | 3 +-- htdocs/comm/propal.php | 2 +- htdocs/commande/fiche.php | 2 +- htdocs/compta/facture.php | 10 +++++++--- htdocs/compta/propal.php | 1 - htdocs/product/droitpret/droitpret.class.php | 3 +-- htdocs/product/droitpret/index.php | 3 --- 9 files changed, 13 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 6264bcd3e87..1d9affdf267 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -203,11 +203,10 @@ class Adherent extends CommonObject $subjectosend = preg_replace ($patterns, $replace, $subject); // Envoi mail confirmation - include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); - $from=$conf->email_from; if ($conf->global->ADHERENT_MAIL_FROM) $from=$conf->global->ADHERENT_MAIL_FROM; + include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); $mailfile = new CMailFile($subjectosend,$this->email,$from,$texttosend, $filename_list,$mimetype_list,$mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $html); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 6de2835a4f2..2b13900f9ed 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -85,8 +85,6 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"]) } if ($sendto) { - require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); - // Le message est-il en html $msgishtml=0; // Non par defaut //if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) $msgishtml=1; @@ -96,6 +94,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"]) $subject=make_substitutions($subject,$substitutionarrayfortest); $body=make_substitutions($body,$substitutionarrayfortest); + require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); $mailfile = new CMailFile($subject,$sendto,$email_from,$body, $filepath,$mimetype,$filename, '', '', 0, $msgishtml,$errors_to); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 4a239a2d504..9e52a9d8d4a 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -76,8 +76,6 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"]) } if ($mil->sendto) { - require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); - $arr_file = array(); $arr_mime = array(); $arr_name = array(); @@ -91,6 +89,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"]) $mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest); $mil->body=make_substitutions($mil->body,$substitutionarrayfortest); + require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); $mailfile = new CMailFile($mil->sujet,$mil->sendto,$mil->email_from,$mil->body, $arr_file,$arr_mime,$arr_name, '', '', 0, $msgishtml); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 49ef8a046fe..a80e55b25a0 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -47,7 +47,6 @@ if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; if (isset($_GET["msg"])) { $mesg=urldecode($_GET["mesg"]); } @@ -382,6 +381,7 @@ if ($_POST['action'] == 'send') } // Envoi de la propal + require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8900f8fb080..4db02e7e2ac 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -33,7 +33,6 @@ require('./pre.inc.php'); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php"); require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); -require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php'); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); @@ -632,6 +631,7 @@ if ($_POST['action'] == 'send') } // Envoi de la commande + require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 5b4f21ea73c..e7ddfc98a18 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -36,7 +36,6 @@ require_once(DOL_DOCUMENT_ROOT.'/facture.class.php'); require_once(DOL_DOCUMENT_ROOT.'/discount.class.php'); require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); -require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php'); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT.'/contrat/contrat.class.php'); @@ -1030,6 +1029,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c } // Envoi de la facture + require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error) { @@ -2053,7 +2053,8 @@ else print ''.img_object($langs->trans('ShowPayment'),'payment').' '; print dolibarr_print_date($objp->dp,'day').''; print ''.$objp->paiement_type.' '.$objp->num_paiement.''; - print ''.price($objp->amount).''.$langs->trans('Currency'.$conf->monnaie).''; + print ''.price($objp->amount).''; + print ''.$langs->trans('Currency'.$conf->monnaie).''; print ''; $i++; } @@ -2083,7 +2084,10 @@ else $invoice->fetch($obj->fk_facture_source); print $invoice->getNomUrl(0); print ' :'; - print ''.price($obj->amount_ttc).''.$langs->trans('Currency'.$conf->monnaie).''; + print ''.price($obj->amount_ttc).''; + print ''.$langs->trans('Currency'.$conf->monnaie); + print ' rowid.'">'.img_delete().''; + print ''; $i++; } } diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 71b6546677a..74f449c0031 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -30,7 +30,6 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php'); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); diff --git a/htdocs/product/droitpret/droitpret.class.php b/htdocs/product/droitpret/droitpret.class.php index 27934b2855d..aaa33771c75 100644 --- a/htdocs/product/droitpret/droitpret.class.php +++ b/htdocs/product/droitpret/droitpret.class.php @@ -216,8 +216,7 @@ class DroitPret $sendtocc = ""; $deliveryreceipt = ""; - - + require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error) { diff --git a/htdocs/product/droitpret/index.php b/htdocs/product/droitpret/index.php index b075cfb36b5..af2ec6182e2 100644 --- a/htdocs/product/droitpret/index.php +++ b/htdocs/product/droitpret/index.php @@ -17,8 +17,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ - * */ /** @@ -31,7 +29,6 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT ."/product/droitpret/droitpret.class.php"); require_once(DOL_DOCUMENT_ROOT ."/product/droitpret/modules_droitpret.php"); -require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); global $conf;