Fix: EMail sent message

This commit is contained in:
Laurent Destailleur
2011-07-02 16:48:31 +00:00
parent 5989803c8a
commit d4f3e5a0df
13 changed files with 159 additions and 137 deletions

View File

@@ -20,7 +20,7 @@
/** /**
* \file htdocs/admin/mails.php * \file htdocs/admin/mails.php
* \brief Page to setup emails sending * \brief Page to setup emails sending
* \version $Id$ * \version $Id: mails.php,v 1.70 2011/07/02 16:48:31 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -218,7 +218,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
if ($result) if ($result)
{ {
$message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$email_from,$sendto).'</div>'; $message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)).'</div>';
} }
else else
{ {
@@ -746,5 +746,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/02 16:48:31 $ - $Revision: 1.70 $');
?> ?>

View File

@@ -21,7 +21,7 @@
* \file htdocs/comm/mailing/fiche.php * \file htdocs/comm/mailing/fiche.php
* \ingroup mailing * \ingroup mailing
* \brief Fiche mailing, onglet general * \brief Fiche mailing, onglet general
* \version $Id$ * \version $Id: fiche.php,v 1.121 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@@ -351,7 +351,7 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"]))
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'</div>'; $message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($mil->email_from,2),$mailfile->getValidAddress($mil->sendto,2)).'</div>';
} }
else else
{ {
@@ -1073,5 +1073,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.121 $');
?> ?>

View File

@@ -27,7 +27,7 @@
* \file htdocs/comm/propal.php * \file htdocs/comm/propal.php
* \ingroup propale * \ingroup propale
* \brief Page of commercial proposals card and list * \brief Page of commercial proposals card and list
* \version $Id: propal.php,v 1.606 2011/06/30 13:27:21 hregis Exp $ * \version $Id: propal.php,v 1.607 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -536,7 +536,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
$error=0; $error=0;
@@ -1021,7 +1021,7 @@ if ($id > 0 || ! empty($ref))
/* /*
* Show object in view mode * Show object in view mode
*/ */
dol_htmloutput_mesg($mesg,$mesgs); dol_htmloutput_mesg($mesg,$mesgs);
$object->fetch($id,$ref); $object->fetch($id,$ref);
@@ -1975,6 +1975,6 @@ else
} }
$db->close(); $db->close();
llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.606 $'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.607 $');
?> ?>

View File

@@ -26,7 +26,7 @@
* \file htdocs/commande/fiche.php * \file htdocs/commande/fiche.php
* \ingroup commande * \ingroup commande
* \brief Page to show customer order * \brief Page to show customer order
* \version $Id: fiche.php,v 1.522 2011/07/02 13:09:52 eldy Exp $ * \version $Id: fiche.php,v 1.523 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -1054,7 +1054,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contains " $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contains "
$error=0; $error=0;
@@ -2134,5 +2134,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/02 13:09:52 $ - $Revision: 1.522 $'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.523 $');
?> ?>

View File

@@ -26,7 +26,7 @@
* \file htdocs/compta/facture.php * \file htdocs/compta/facture.php
* \ingroup facture * \ingroup facture
* \brief Page to create/see an invoice * \brief Page to create/see an invoice
* \version $Id: facture.php,v 1.843 2011/07/02 13:09:52 eldy Exp $ * \version $Id: facture.php,v 1.844 2011/07/02 16:48:32 eldy Exp $
*/ */
require('../main.inc.php'); require('../main.inc.php');
@@ -1307,7 +1307,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
$error=0; $error=0;
@@ -3235,5 +3235,5 @@ else
$db->close(); $db->close();
llxFooter('$Date: 2011/07/02 13:09:52 $ - $Revision: 1.843 $'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.844 $');
?> ?>

View File

@@ -25,7 +25,7 @@
* \file htdocs/expedition/fiche.php * \file htdocs/expedition/fiche.php
* \ingroup expedition * \ingroup expedition
* \brief Fiche descriptive d'une expedition * \brief Fiche descriptive d'une expedition
* \version $Id$ * \version $Id: fiche.php,v 1.208 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -398,7 +398,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$from,$sendto); $_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
$error=0; $error=0;
@@ -1381,5 +1381,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.208 $');
?> ?>

View File

@@ -22,7 +22,7 @@
/** \file htdocs/fichinter/class/fichinter.class.php /** \file htdocs/fichinter/class/fichinter.class.php
* \ingroup ficheinter * \ingroup ficheinter
* \brief Fichier de la classe des gestion des fiches interventions * \brief Fichier de la classe des gestion des fiches interventions
* \version $Id: fichinter.class.php,v 1.17 2011/07/01 16:24:44 simnandez Exp $ * \version $Id: fichinter.class.php,v 1.18 2011/07/02 16:48:32 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -169,10 +169,10 @@ class Fichinter extends CommonObject
} }
/* /*
* \brief Met a jour une intervention * Met a jour une intervention
* \return int <0 si ko, >0 si ok * @return int <0 if KO, >0 if OK
*/ */
function update($id) function update($user)
{ {
global $conf; global $conf;
@@ -186,7 +186,7 @@ class Fichinter extends CommonObject
$sql.= ", description = '".$this->db->escape($this->description)."'"; $sql.= ", description = '".$this->db->escape($this->description)."'";
$sql.= ", duree = ".$this->duree; $sql.= ", duree = ".$this->duree;
$sql.= ", fk_projet = ".$this->fk_project; $sql.= ", fk_projet = ".$this->fk_project;
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
dol_syslog("Fichinter::update sql=".$sql); dol_syslog("Fichinter::update sql=".$sql);
@@ -239,7 +239,7 @@ class Fichinter extends CommonObject
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf;
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
/* /*
* Lines * Lines
*/ */
@@ -348,7 +348,7 @@ class Fichinter extends CommonObject
} }
} }
} }
/** /**
* set intervetnion as billed * set intervetnion as billed
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
@@ -361,7 +361,7 @@ class Fichinter extends CommonObject
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_statut = 1"; $sql.= " AND fk_statut = 1";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
return 1; return 1;
@@ -372,7 +372,7 @@ class Fichinter extends CommonObject
return -1; return -1;
} }
} }
/** /**
* \brief Retourne le libelle du statut * \brief Retourne le libelle du statut
@@ -405,25 +405,25 @@ class Fichinter extends CommonObject
if ($mode == 2) if ($mode == 2)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6').' '.$langs->trans('StatusOrderProcessed'); if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6').' '.$langs->trans('StatusOrderProcessed');
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6'); if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6');
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6').' '.$langs->trans('StatusInterInvoiced'); if ($statut==2) return img_picto($langs->trans('StatusInterInvoiced'),'statut6').' '.$langs->trans('StatusInterInvoiced');
} }
if ($mode == 5) if ($mode == 5)
{ {
if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2) return $langs->trans('StatusInterInvoiced').' '.img_picto($langs->trans('StatusInterInvoiced'),'statut6'); if ($statut==2) return $langs->trans('StatusInterInvoiced').' '.img_picto($langs->trans('StatusInterInvoiced'),'statut6');
} }
} }
@@ -562,7 +562,7 @@ class Fichinter extends CommonObject
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
// Delete linked object // Delete linked object
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
$sql.= " WHERE fk_target = ".$this->id; $sql.= " WHERE fk_target = ".$this->id;
@@ -573,7 +573,7 @@ class Fichinter extends CommonObject
dol_syslog("Fichinter::delete error", LOG_ERR); dol_syslog("Fichinter::delete error", LOG_ERR);
$error++; $error++;
} }
// Delete linked contacts // Delete linked contacts
$res = $this->delete_linked_contact(); $res = $this->delete_linked_contact();
if ($res < 0) if ($res < 0)
@@ -581,7 +581,7 @@ class Fichinter extends CommonObject
$this->error='ErrorFailToDeleteLinkedContact'; $this->error='ErrorFailToDeleteLinkedContact';
$error++; $error++;
} }
if ($err > 0) if ($err > 0)
{ {
$this->db->rollback(); $this->db->rollback();

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
@@ -23,7 +23,7 @@
* \file htdocs/fichinter/fiche.php * \file htdocs/fichinter/fiche.php
* \brief Fichier fiche intervention * \brief Fichier fiche intervention
* \ingroup ficheinter * \ingroup ficheinter
* \version $Id: fiche.php,v 1.163 2011/07/01 16:24:44 simnandez Exp $ * \version $Id: fiche.php,v 1.164 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -45,12 +45,16 @@ if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."
$langs->load("companies"); $langs->load("companies");
$langs->load("interventions"); $langs->load("interventions");
$id=GETPOST('id');
$action=GETPOST("action");
$mesg=GETPOST("msg");
// Load object if defined // Load object if defined
$fichinterid=0; $fichinterid=0;
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
if ($_GET["id"] > 0 || ! empty($_GET["ref"])) if ($id > 0 || ! empty($_GET["ref"]))
{ {
$result=$fichinter->fetch($_GET["id"],$_GET["ref"]); $result=$fichinter->fetch($id,$_GET["ref"]);
if (! $result > 0) if (! $result > 0)
{ {
dol_print_error($db); dol_print_error($db);
@@ -59,8 +63,6 @@ if ($_GET["id"] > 0 || ! empty($_GET["ref"]))
$fichinterid=$fichinter->id; $fichinterid=$fichinter->id;
} }
$mesg=GETPOST("msg");
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter');
@@ -71,16 +73,16 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter');
* Actions * Actions
*/ */
if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && $_REQUEST["action"] != 'classifybilled' && ! ($_REQUEST["id"] > 0) && empty($_REQUEST["ref"])) if ($action != 'create' && $action != 'add' && $action != 'classifybilled' && ! ($_REQUEST["id"] > 0) && empty($_REQUEST["ref"]))
{ {
Header("Location: index.php"); Header("Location: index.php");
return; exit;
} }
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') if ($action == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET["id"]); $fichinter->fetch($id);
$fichinter->fetch_thirdparty(); $fichinter->fetch_thirdparty();
$result = $fichinter->setValid($user, $conf->fichinter->outputdir); $result = $fichinter->setValid($user, $conf->fichinter->outputdir);
@@ -106,10 +108,10 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
} }
} }
if ($_REQUEST['action'] == 'confirm_modify' && $_REQUEST['confirm'] == 'yes') if ($action == 'confirm_modify' && $_REQUEST['confirm'] == 'yes')
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET["id"]); $fichinter->fetch($id);
$fichinter->fetch_thirdparty(); $fichinter->fetch_thirdparty();
$result = $fichinter->setDraft($user); $result = $fichinter->setDraft($user);
@@ -152,27 +154,28 @@ if ($_POST["action"] == 'add')
$result = $fichinter->create(); $result = $fichinter->create();
if ($result > 0) if ($result > 0)
{ {
$_GET["id"]=$result; // Force raffraichissement sur fiche venant d'etre cree $id=$result; // Force raffraichissement sur fiche venant d'etre cree
$fichinterid=$result; $fichinterid=$result;
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans($fichinter->error).'</div>'; $mesg='<div class="error">'.$langs->trans($fichinter->error).'</div>';
$_GET["action"] = 'create'; $action = 'create';
$_GET["socid"] = $_POST["socid"]; $_GET["socid"] = $_POST["socid"];
} }
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'</div>';
$_GET["action"] = 'create'; $action = 'create';
} }
} }
if ($_POST["action"] == 'update') if ($_POST["action"] == 'update')
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($id);
$fichinter->socid = $_POST["socid"]; $fichinter->socid = $_POST["socid"];
$fichinter->fk_project = $_POST["projectid"]; $fichinter->fk_project = $_POST["projectid"];
@@ -180,17 +183,16 @@ if ($_POST["action"] == 'update')
$fichinter->description = $_POST["description"]; $fichinter->description = $_POST["description"];
$fichinter->ref = $_POST["ref"]; $fichinter->ref = $_POST["ref"];
$fichinter->update($_POST["id"]); $fichinter->update($user);
$_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre creee
} }
/* /*
* Build doc * Build doc
*/ */
if ($_REQUEST['action'] == 'builddoc') // En get ou en post if ($action == 'builddoc') // En get ou en post
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($id);
$fichinter->fetch_thirdparty(); $fichinter->fetch_thirdparty();
$fichinter->fetch_lines(); $fichinter->fetch_lines();
@@ -218,36 +220,36 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
} }
// Set into a project // Set into a project
if ($_POST['action'] == 'classin') if ($action == 'classin')
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($id);
$result=$fichinter->setProject($_POST['projectid']); $result=$fichinter->setProject($_POST['projectid']);
if ($result < 0) dol_print_error($db,$fichinter->error); if ($result < 0) dol_print_error($db,$fichinter->error);
} }
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') if ($action == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
{ {
if ($user->rights->ficheinter->supprimer) if ($user->rights->ficheinter->supprimer)
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($id);
$fichinter->delete($user); $fichinter->delete($user);
} }
Header('Location: index.php?leftmenu=ficheinter'); Header('Location: index.php?leftmenu=ficheinter');
exit; exit;
} }
if ($_POST['action'] == 'setdescription') if ($action == 'setdescription')
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($id);
$result=$fichinter->set_description($user,$_POST['description']); $result=$fichinter->set_description($user,$_POST['description']);
if ($result < 0) dol_print_error($db,$fichinter->error); if ($result < 0) dol_print_error($db,$fichinter->error);
} }
// Add line // Add line
if ($_POST['action'] == "addline" && $user->rights->ficheinter->creer) if ($action == "addline" && $user->rights->ficheinter->creer)
{ {
if ($_POST['np_desc'] && ($_POST['durationhour'] || $_POST['durationmin'])) if ($_POST['np_desc'] && ($_POST['durationhour'] || $_POST['durationmin']))
{ {
@@ -283,15 +285,26 @@ if ($_POST['action'] == "addline" && $user->rights->ficheinter->creer)
} }
// Classify Billed // Classify Billed
if ($_GET['action'] == 'classifybilled') if ($action == 'classifybilled')
{ {
$fichinter->setBilled(); $fichinter = new Fichinter($db);
$fichinter->fetch($id);
$result=$fichinter->setBilled();
if ($result > 0)
{
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST['fichinterid']);
exit;
}
else
{
$mesg='<div class="error">'.$fichinter->error.'</div>';
}
} }
/* /*
* Mise a jour d'une ligne d'intervention * Mise a jour d'une ligne d'intervention
*/ */
if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save"] == $langs->trans("Save")) if ($action == 'updateligne' && $user->rights->ficheinter->creer && $_POST["save"] == $langs->trans("Save"))
{ {
$fichinterline = new FichinterLigne($db); $fichinterline = new FichinterLigne($db);
if ($fichinterline->fetch($_POST['ligne']) <= 0) if ($fichinterline->fetch($_POST['ligne']) <= 0)
@@ -349,7 +362,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
/* /*
* Supprime une ligne d'intervention AVEC confirmation * Supprime une ligne d'intervention AVEC confirmation
*/ */
if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') if ($action == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes')
{ {
if ($user->rights->ficheinter->creer) if ($user->rights->ficheinter->creer)
{ {
@@ -379,7 +392,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
} }
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
} }
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']); Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
} }
@@ -387,10 +400,10 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
* Ordonnancement des lignes * Ordonnancement des lignes
*/ */
if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer) if ($action == 'up' && $user->rights->ficheinter->creer)
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($id);
$fichinter->fetch_thirdparty(); $fichinter->fetch_thirdparty();
$fichinter->line_up($_GET['rowid']); $fichinter->line_up($_GET['rowid']);
@@ -405,14 +418,14 @@ if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer)
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']);
exit; exit;
} }
if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer) if ($action == 'down' && $user->rights->ficheinter->creer)
{ {
$fichinter = new Fichinter($db); $fichinter = new Fichinter($db);
$fichinter->fetch($_GET['id']); $fichinter->fetch($id);
$fichinter->fetch_thirdparty(); $fichinter->fetch_thirdparty();
$fichinter->line_down($_GET['rowid']); $fichinter->line_down($_GET['rowid']);
@@ -427,14 +440,14 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']);
exit; exit;
} }
/* /*
* Send mail * Send mail
*/ */
if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)) if ($action == 'send' && ! $_POST['cancel'] && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send))
{ {
$langs->load('mails'); $langs->load('mails');
@@ -479,7 +492,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA
$sendtocc = $_POST['sendtocc']; $sendtocc = $_POST['sendtocc'];
$deliveryreceipt = $_POST['deliveryreceipt']; $deliveryreceipt = $_POST['deliveryreceipt'];
if ($_POST['action'] == 'send') if ($action == 'send')
{ {
if (strlen($_POST['subject'])) $subject = $_POST['subject']; if (strlen($_POST['subject'])) $subject = $_POST['subject'];
else $subject = $langs->transnoentities('Intervention').' '.$fichinter->ref; else $subject = $langs->transnoentities('Intervention').' '.$fichinter->ref;
@@ -515,7 +528,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'.</div>';
$error=0; $error=0;
@@ -583,6 +596,8 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Intervention")).'</div>'; $mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Intervention")).'</div>';
dol_syslog('Impossible de lire les donnees de l\'intervention. Le fichier intervention n\'a peut-etre pas ete genere.'); dol_syslog('Impossible de lire les donnees de l\'intervention. Le fichier intervention n\'a peut-etre pas ete genere.');
} }
$action='presend';
} }
@@ -595,7 +610,7 @@ $formfile = new FormFile($db);
llxHeader(); llxHeader();
if ($_GET["action"] == 'create') if ($action == 'create')
{ {
/* /*
* Mode creation * Mode creation
@@ -610,7 +625,7 @@ if ($_GET["action"] == 'create')
print_fiche_titre($langs->trans("AddIntervention")); print_fiche_titre($langs->trans("AddIntervention"));
if ($mesg) print $mesg.'<br>'; dol_htmloutput_mesg($mesg);
if (! $conf->global->FICHEINTER_ADDON) if (! $conf->global->FICHEINTER_ADDON)
{ {
@@ -710,7 +725,7 @@ elseif ($fichinterid)
$societe->fetch($fichinter->socid); $societe->fetch($fichinter->socid);
dol_htmloutput_errors($mesg); dol_htmloutput_mesg($mesg);
$head = fichinter_prepare_head($fichinter); $head = fichinter_prepare_head($fichinter);
@@ -718,28 +733,28 @@ elseif ($fichinterid)
dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention'); dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, 'intervention');
// Confirmation de la suppression de la fiche d'intervention // Confirmation de la suppression de la fiche d'intervention
if ($_GET['action'] == 'delete') if ($action == 'delete')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Confirmation validation // Confirmation validation
if ($_GET['action'] == 'validate') if ($action == 'validate')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Confirmation de la validation de la fiche d'intervention // Confirmation de la validation de la fiche d'intervention
if ($_GET['action'] == 'modify') if ($action == 'modify')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Confirmation de la suppression d'une ligne d'intervention // Confirmation de la suppression d'une ligne d'intervention
if ($_GET['action'] == 'ask_deleteline') if ($action == 'ask_deleteline')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
@@ -767,10 +782,10 @@ elseif ($fichinterid)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Description'); print $langs->trans('Description');
print '</td>'; print '</td>';
if ($_GET['action'] != 'editdescription' && $fichinter->statut == 0) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdescription&amp;id='.$fichinter->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>'; if ($action != 'editdescription' && $fichinter->statut == 0) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdescription&amp;id='.$fichinter->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($_GET['action'] == 'editdescription') if ($action == 'editdescription')
{ {
print '<form name="editdescription" action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'" method="post">'; print '<form name="editdescription" action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -781,7 +796,7 @@ elseif ($fichinterid)
} }
else else
{ {
print nl2br($fichinter->description); print dol_nl2br($fichinter->description);
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@@ -796,7 +811,7 @@ elseif ($fichinterid)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Project'); print $langs->trans('Project');
print '</td>'; print '</td>';
if ($_GET['action'] != 'classin') if ($action != 'classin')
{ {
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classin&amp;id='.$fichinter->id.'">'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classin&amp;id='.$fichinter->id.'">';
print img_edit($langs->trans('SetProject'),1); print img_edit($langs->trans('SetProject'),1);
@@ -804,7 +819,7 @@ elseif ($fichinterid)
} }
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($_GET['action'] == 'classin') if ($action == 'classin')
{ {
$html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'projectid'); $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'projectid');
} }
@@ -854,7 +869,7 @@ elseif ($fichinterid)
$var=!$var; $var=!$var;
// Ligne en mode visu // Ligne en mode visu
if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid) if ($action != 'editline' || $_GET['ligne'] != $objp->rowid)
{ {
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'; print '<td>';
@@ -909,7 +924,7 @@ elseif ($fichinterid)
} }
// Ligne en mode update // Ligne en mode update
if ($fichinter->statut == 0 && $_GET["action"] == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid) if ($fichinter->statut == 0 && $action == 'editline' && $user->rights->ficheinter->creer && $_GET["ligne"] == $objp->rowid)
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'#'.$objp->rowid.'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'#'.$objp->rowid.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -951,7 +966,7 @@ elseif ($fichinterid)
/* /*
* Ajouter une ligne * Ajouter une ligne
*/ */
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $_GET["action"] <> 'editline') if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $action <> 'editline')
{ {
if (! $num) print '<br><table class="noborder" width="100%">'; if (! $num) print '<br><table class="noborder" width="100%">';
@@ -1019,19 +1034,19 @@ elseif ($fichinterid)
if ($user->societe_id == 0) if ($user->societe_id == 0)
{ {
if ($_GET['action'] != 'editdescription') if ($action != 'editdescription')
{ {
// Validate // Validate
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) if ($fichinter->statut == 0 && $user->rights->ficheinter->creer)
{ {
print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=validate"'; print '<a class="butAction" href="fiche.php?id='.$id.'&action=validate"';
print '>'.$langs->trans("Valid").'</a>'; print '>'.$langs->trans("Valid").'</a>';
} }
// Modify // Modify
if ($fichinter->statut == 1 && $user->rights->ficheinter->creer) if ($fichinter->statut == 1 && $user->rights->ficheinter->creer)
{ {
print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=modify"'; print '<a class="butAction" href="fiche.php?id='.$id.'&action=modify"';
print '>'.$langs->trans("Modify").'</a>'; print '>'.$langs->trans("Modify").'</a>';
} }
@@ -1044,38 +1059,38 @@ elseif ($fichinterid)
{ {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>';
} }
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>'; else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
} }
} }
//Invoicing // Invoicing
if ($conf->global->MAIN_FEATURES_LEVEL>=2) if ($conf->facture->enabled && $fichinter->statut > 0)
{ {
if ($conf->facture->enabled && $fichinter->statut > 0) $langs->load("bills");
{ if ($fichinter->statut < 2)
$langs->load("bills"); {
if ($fichinter->statut < 2) if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$fichinter->element.'&amp;originid='.$fichinter->id.'&amp;socid='.$fichinter->socid.'">'.$langs->trans("CreateBill").'</a>';
{ else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$fichinter->element.'&amp;originid='.$fichinter->id.'&amp;socid='.$fichinter->socid.'">'.$langs->trans("CreateBill").'</a>'; }
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
} if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED))
{
if ($fichinter->statut != 2) if ($fichinter->statut != 2)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
} }
} }
} }
// Delete // Delete
if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&amp;action=delete"'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&amp;action=delete"';
print '>'.$langs->trans('Delete').'</a>'; print '>'.$langs->trans('Delete').'</a>';
} }
} }
} }
@@ -1085,7 +1100,7 @@ elseif ($fichinterid)
/* /*
* Action presend * Action presend
*/ */
if ($_GET['action'] == 'presend') if ($action == 'presend')
{ {
$ref = dol_sanitizeFileName($fichinter->ref); $ref = dol_sanitizeFileName($fichinter->ref);
$file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf';
@@ -1163,5 +1178,5 @@ elseif ($fichinterid)
$db->close(); $db->close();
llxFooter('$Date: 2011/07/01 16:24:44 $ - $Revision: 1.163 $'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.164 $');
?> ?>

View File

@@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
* \file htdocs/fichinter/index.php * \file htdocs/fichinter/index.php
* \brief List of all interventions * \brief List of all interventions
* \ingroup ficheinter * \ingroup ficheinter
* \version $Id$ * \version $Id: index.php,v 1.65 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../main.inc.php"); require("../main.inc.php");
@@ -117,10 +117,11 @@ if ($result)
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">'; print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
print '</td><td class="liste_titre">'; print '</td><td class="liste_titre">';
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">'; print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
print '</td><td class="liste_titre" colspan="2">'; print '</td><td class="liste_titre">';
print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="24">'; print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print "</tr>\n"; print "</tr>\n";
@@ -145,7 +146,8 @@ if ($result)
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->client=$objp->client; $companystatic->client=$objp->client;
print $companystatic->getNomUrl(1,'',44); print $companystatic->getNomUrl(1,'',44);
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).'</td>'; print '</td>';
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).'</td>';
print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).'</td>'; print '<td>'.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'dayhour')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'dayhour')."</td>\n";
print '<td align="right">'.ConvertSecondToTime($objp->duree).'</td>'; print '<td align="right">'.ConvertSecondToTime($objp->duree).'</td>';
@@ -171,5 +173,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.65 $');
?> ?>

View File

@@ -25,7 +25,7 @@
* \file htdocs/fourn/commande/fiche.php * \file htdocs/fourn/commande/fiche.php
* \ingroup supplier, order * \ingroup supplier, order
* \brief Card supplier order * \brief Card supplier order
* \version $Id$ * \version $Id: fiche.php,v 1.230 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@@ -559,7 +559,7 @@ if ($action == 'create')
} }
$id=$orderid; $id=$orderid;
$db->commit(); $db->commit();
} }
else else
@@ -685,7 +685,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
$error=0; $error=0;
@@ -1545,5 +1545,5 @@ if ($id > 0 || ! empty($ref))
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.230 $');
?> ?>

View File

@@ -25,7 +25,7 @@
* \file htdocs/fourn/facture/fiche.php * \file htdocs/fourn/facture/fiche.php
* \ingroup facture, fournisseur * \ingroup facture, fournisseur
* \brief Page for supplier invoice card (view, edit, validate) * \brief Page for supplier invoice card (view, edit, validate)
* \version $Id$ * \version $Id: fiche.php,v 1.259 2011/07/02 16:48:32 eldy Exp $
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
@@ -738,7 +738,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();
if ($result) if ($result)
{ {
$mesg=$langs->trans('MailSuccessfulySent',$from,$sendto); // Must not contain " $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
$error=0; $error=0;
@@ -1916,5 +1916,5 @@ else
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.259 $');
?> ?>

View File

@@ -25,7 +25,7 @@
/** /**
* \file htdocs/lib/CMailFile.class.php * \file htdocs/lib/CMailFile.class.php
* \brief File of class to send emails (with attachments or not) * \brief File of class to send emails (with attachments or not)
* \version $Id$ * \version $Id: CMailFile.class.php,v 1.142 2011/07/02 16:48:31 eldy Exp $
* \author Dan Potter. * \author Dan Potter.
* \author Eric Seigne * \author Eric Seigne
* \author Laurent Destailleur. * \author Laurent Destailleur.
@@ -416,7 +416,7 @@ class CMailFile
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
$res=false; $res=false;
} }
if ($res) if ($res)
{ {
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
@@ -604,7 +604,7 @@ class CMailFile
$out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol; $out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol;
$out.= "Content-Transfer-Encoding: 8bit".$this->eol; $out.= "Content-Transfer-Encoding: 8bit".$this->eol;
dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out); dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
return $out; return $out;
} }
@@ -649,7 +649,7 @@ class CMailFile
global $conf; global $conf;
$out=''; $out='';
if ($this->atleastoneimage) if ($this->atleastoneimage)
{ {
$out.= "--" . $this->mixed_boundary . $this->eol; $out.= "--" . $this->mixed_boundary . $this->eol;
@@ -661,7 +661,7 @@ class CMailFile
{ {
$out.= "--" . $this->mixed_boundary . $this->eol; $out.= "--" . $this->mixed_boundary . $this->eol;
} }
if ($this->msgishtml) if ($this->msgishtml)
{ {
// Check if html header already in message // Check if html header already in message
@@ -680,7 +680,7 @@ class CMailFile
if ($this->msgishtml) if ($this->msgishtml)
{ {
if ($this->atleastoneimage) if ($this->atleastoneimage)
{ {
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
$out.= $this->eol.strip_tags($strContent).$this->eol; // Add plain text message $out.= $this->eol.strip_tags($strContent).$this->eol; // Add plain text message
@@ -697,7 +697,7 @@ class CMailFile
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
$out.= $this->eol.$strContent.$this->eol; $out.= $this->eol.$strContent.$this->eol;
} }
$out.= $this->eol; $out.= $this->eol;
return $out; return $out;
@@ -940,7 +940,7 @@ class CMailFile
/** /**
* Return an address for SMTP protocol * Return an address for SMTP protocol
* *
* @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com' * @param adresses Example: 'John Doe <john@doe.com>' or 'john@doe.com'
* @param format 0=Auto, 1=emails with <>, 2=emails without <> * @param format 0=Auto, 1=emails with <>, 2=emails without <>
* @param encode 1=Encode name to RFC2822 * @param encode 1=Encode name to RFC2822
* @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>' * @return string If format 1: '<john@doe.com>' or 'John Doe <john@doe.com>'

View File

@@ -29,7 +29,7 @@
* \file htdocs/lib/functions.lib.php * \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.532 2011/06/26 00:42:23 eldy Exp $ * \version $Id: functions.lib.php,v 1.533 2011/07/02 16:48:31 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
@@ -3842,7 +3842,12 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb
else if ($mesgstring && preg_match('/class="error"/i',$mesgstring)) $iserror++; else if ($mesgstring && preg_match('/class="error"/i',$mesgstring)) $iserror++;
if ($style=='error') $iserror++; if ($style=='error') $iserror++;
if ($iserror) print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); if ($iserror)
{
$mesgstring=preg_replace('/<div class="error">/','',$mesgstring);
$mesgstring=preg_replace('/<\/div>/','',$mesgstring);
print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded);
}
else print get_htmloutput_mesg($mesgstring,$mesgarray,'ok',$keepembedded); else print get_htmloutput_mesg($mesgstring,$mesgarray,'ok',$keepembedded);
} }