diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 8c5ac745689..6f6bb746336 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -20,7 +20,7 @@ /** * \file htdocs/admin/mails.php * \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"); @@ -218,7 +218,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml') if ($result) { - $message='
'.$langs->trans("MailSuccessfulySent",$email_from,$sendto).'
'; + $message='
'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)).'
'; } else { @@ -746,5 +746,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:31 $ - $Revision: 1.70 $'); ?> diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index e00a44ab5d8..687a5e9053d 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -21,7 +21,7 @@ * \file htdocs/comm/mailing/fiche.php * \ingroup mailing * \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"); @@ -351,7 +351,7 @@ if ($_POST["action"] == 'send' && empty($_POST["cancel"])) $result=$mailfile->sendfile(); if ($result) { - $message='
'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'
'; + $message='
'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($mil->email_from,2),$mailfile->getValidAddress($mil->sendto,2)).'
'; } else { @@ -1073,5 +1073,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.121 $'); ?> diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 27251fbc322..81169c18ab8 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -27,7 +27,7 @@ * \file htdocs/comm/propal.php * \ingroup propale * \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"); @@ -536,7 +536,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] $result=$mailfile->sendfile(); 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; @@ -1021,7 +1021,7 @@ if ($id > 0 || ! empty($ref)) /* * Show object in view mode */ - + dol_htmloutput_mesg($mesg,$mesgs); $object->fetch($id,$ref); @@ -1975,6 +1975,6 @@ else } $db->close(); -llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.606 $'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.607 $'); ?> diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 4287c992a4c..896f166899b 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -26,7 +26,7 @@ * \file htdocs/commande/fiche.php * \ingroup commande * \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"); @@ -1054,7 +1054,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P $result=$mailfile->sendfile(); 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; @@ -2134,5 +2134,5 @@ else $db->close(); -llxFooter('$Date: 2011/07/02 13:09:52 $ - $Revision: 1.522 $'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.523 $'); ?> diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c5bcd129280..4d2df43896a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -26,7 +26,7 @@ * \file htdocs/compta/facture.php * \ingroup facture * \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'); @@ -1307,7 +1307,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $result=$mailfile->sendfile(); 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; @@ -3235,5 +3235,5 @@ else $db->close(); -llxFooter('$Date: 2011/07/02 13:09:52 $ - $Revision: 1.843 $'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.844 $'); ?> diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index e219919ae1d..4955f460ed0 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/expedition/fiche.php * \ingroup 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"); @@ -398,7 +398,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P $result=$mailfile->sendfile(); if ($result) { - $_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$from,$sendto); + $_SESSION['mesg']=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); $error=0; @@ -1381,5 +1381,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.208 $'); ?> diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 80334bba8b6..87f9ca8fcc9 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -22,7 +22,7 @@ /** \file htdocs/fichinter/class/fichinter.class.php * \ingroup ficheinter * \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"); @@ -169,10 +169,10 @@ class Fichinter extends CommonObject } /* - * \brief Met a jour une intervention - * \return int <0 si ko, >0 si ok + * Met a jour une intervention + * @return int <0 if KO, >0 if OK */ - function update($id) + function update($user) { global $conf; @@ -186,7 +186,7 @@ class Fichinter extends CommonObject $sql.= ", description = '".$this->db->escape($this->description)."'"; $sql.= ", duree = ".$this->duree; $sql.= ", fk_projet = ".$this->fk_project; - $sql.= " WHERE rowid = ".$id; + $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; dol_syslog("Fichinter::update sql=".$sql); @@ -239,7 +239,7 @@ class Fichinter extends CommonObject $this->modelpdf = $obj->model_pdf; if ($this->statut == 0) $this->brouillon = 1; - + /* * Lines */ @@ -348,7 +348,7 @@ class Fichinter extends CommonObject } } } - + /** * set intervetnion as billed * @return int <0 si ko, >0 si ok @@ -361,7 +361,7 @@ class Fichinter extends CommonObject $sql.= ' WHERE rowid = '.$this->id; $sql.= " AND entity = ".$conf->entity; $sql.= " AND fk_statut = 1"; - + if ($this->db->query($sql) ) { return 1; @@ -372,7 +372,7 @@ class Fichinter extends CommonObject return -1; } } - + /** * \brief Retourne le libelle du statut @@ -405,25 +405,25 @@ class Fichinter extends CommonObject if ($mode == 2) { 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 ($mode == 3) { 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 ($mode == 4) { 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 ($mode == 5) { 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'); } } @@ -562,7 +562,7 @@ class Fichinter extends CommonObject $error=0; $this->db->begin(); - + // Delete linked object $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element"; $sql.= " WHERE fk_target = ".$this->id; @@ -573,7 +573,7 @@ class Fichinter extends CommonObject dol_syslog("Fichinter::delete error", LOG_ERR); $error++; } - + // Delete linked contacts $res = $this->delete_linked_contact(); if ($res < 0) @@ -581,7 +581,7 @@ class Fichinter extends CommonObject $this->error='ErrorFailToDeleteLinkedContact'; $error++; } - + if ($err > 0) { $this->db->rollback(); diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index d929b3e2a01..530ff8bc91c 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent * @@ -23,7 +23,7 @@ * \file htdocs/fichinter/fiche.php * \brief Fichier fiche intervention * \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"); @@ -45,12 +45,16 @@ if (! empty($conf->global->FICHEINTER_ADDON) && is_readable(DOL_DOCUMENT_ROOT ." $langs->load("companies"); $langs->load("interventions"); +$id=GETPOST('id'); +$action=GETPOST("action"); +$mesg=GETPOST("msg"); + // Load object if defined $fichinterid=0; $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) { dol_print_error($db); @@ -59,8 +63,6 @@ if ($_GET["id"] > 0 || ! empty($_GET["ref"])) $fichinterid=$fichinter->id; } -$mesg=GETPOST("msg"); - // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); @@ -71,16 +73,16 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); * 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"); - return; + exit; } -if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET["id"]); + $fichinter->fetch($id); $fichinter->fetch_thirdparty(); $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->fetch($_GET["id"]); + $fichinter->fetch($id); $fichinter->fetch_thirdparty(); $result = $fichinter->setDraft($user); @@ -152,27 +154,28 @@ if ($_POST["action"] == 'add') $result = $fichinter->create(); 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; } else { $langs->load("errors"); $mesg='
'.$langs->trans($fichinter->error).'
'; - $_GET["action"] = 'create'; + $action = 'create'; $_GET["socid"] = $_POST["socid"]; } } else { $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'
'; - $_GET["action"] = 'create'; + $action = 'create'; } } if ($_POST["action"] == 'update') { $fichinter = new Fichinter($db); + $fichinter->fetch($id); $fichinter->socid = $_POST["socid"]; $fichinter->fk_project = $_POST["projectid"]; @@ -180,17 +183,16 @@ if ($_POST["action"] == 'update') $fichinter->description = $_POST["description"]; $fichinter->ref = $_POST["ref"]; - $fichinter->update($_POST["id"]); - $_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre creee + $fichinter->update($user); } /* * Build doc */ -if ($_REQUEST['action'] == 'builddoc') // En get ou en post +if ($action == 'builddoc') // En get ou en post { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); + $fichinter->fetch($id); $fichinter->fetch_thirdparty(); $fichinter->fetch_lines(); @@ -218,36 +220,36 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post } // Set into a project -if ($_POST['action'] == 'classin') +if ($action == 'classin') { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); + $fichinter->fetch($id); $result=$fichinter->setProject($_POST['projectid']); 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) { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); + $fichinter->fetch($id); $fichinter->delete($user); } Header('Location: index.php?leftmenu=ficheinter'); exit; } -if ($_POST['action'] == 'setdescription') +if ($action == 'setdescription') { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); + $fichinter->fetch($id); $result=$fichinter->set_description($user,$_POST['description']); if ($result < 0) dol_print_error($db,$fichinter->error); } // 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'])) { @@ -283,15 +285,26 @@ if ($_POST['action'] == "addline" && $user->rights->ficheinter->creer) } // 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='
'.$fichinter->error.'
'; + } } /* * 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); 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 */ -if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') +if ($action == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes') { if ($user->rights->ficheinter->creer) { @@ -379,7 +392,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' } fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs); } - Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']); + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } @@ -387,10 +400,10 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' * Ordonnancement des lignes */ -if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer) +if ($action == 'up' && $user->rights->ficheinter->creer) { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); + $fichinter->fetch($id); $fichinter->fetch_thirdparty(); $fichinter->line_up($_GET['rowid']); @@ -405,14 +418,14 @@ if ($_GET['action'] == 'up' && $user->rights->ficheinter->creer) $outputlangs->setDefaultLang($newlang); } 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; } -if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer) +if ($action == 'down' && $user->rights->ficheinter->creer) { $fichinter = new Fichinter($db); - $fichinter->fetch($_GET['id']); + $fichinter->fetch($id); $fichinter->fetch_thirdparty(); $fichinter->line_down($_GET['rowid']); @@ -427,14 +440,14 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer) $outputlangs->setDefaultLang($newlang); } 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; } /* * 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'); @@ -479,7 +492,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA $sendtocc = $_POST['sendtocc']; $deliveryreceipt = $_POST['deliveryreceipt']; - if ($_POST['action'] == 'send') + if ($action == 'send') { if (strlen($_POST['subject'])) $subject = $_POST['subject']; else $subject = $langs->transnoentities('Intervention').' '.$fichinter->ref; @@ -515,7 +528,7 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA $result=$mailfile->sendfile(); if ($result) { - $mesg='
'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
'; + $mesg='
'.$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'.
'; $error=0; @@ -583,6 +596,8 @@ if ($_POST['action'] == 'send' && ! $_POST['cancel'] && (empty($conf->global->MA $mesg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Intervention")).'
'; 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(); -if ($_GET["action"] == 'create') +if ($action == 'create') { /* * Mode creation @@ -610,7 +625,7 @@ if ($_GET["action"] == 'create') print_fiche_titre($langs->trans("AddIntervention")); - if ($mesg) print $mesg.'
'; + dol_htmloutput_mesg($mesg); if (! $conf->global->FICHEINTER_ADDON) { @@ -710,7 +725,7 @@ elseif ($fichinterid) $societe->fetch($fichinter->socid); - dol_htmloutput_errors($mesg); + dol_htmloutput_mesg($mesg); $head = fichinter_prepare_head($fichinter); @@ -718,28 +733,28 @@ elseif ($fichinterid) dol_fiche_head($head, 'card', $langs->trans("InterventionCard"), 0, '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); if ($ret == 'html') print '
'; } // 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); if ($ret == 'html') print '
'; } // 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); if ($ret == 'html') print '
'; } // 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); if ($ret == 'html') print '
'; @@ -767,10 +782,10 @@ elseif ($fichinterid) print ''; - if ($_GET['action'] != 'editdescription' && $fichinter->statut == 0) print ''; + if ($action != 'editdescription' && $fichinter->statut == 0) print ''; print '
'; print $langs->trans('Description'); print 'id.'">'.img_edit($langs->trans('Modify'),1).'id.'">'.img_edit($langs->trans('Modify'),1).'
'; print ''; - if ($_GET['action'] == 'editdescription') + if ($action == 'editdescription') { print '
'; print ''; @@ -781,7 +796,7 @@ elseif ($fichinterid) } else { - print nl2br($fichinter->description); + print dol_nl2br($fichinter->description); } print ''; print ''; @@ -796,7 +811,7 @@ elseif ($fichinterid) print ''; - if ($_GET['action'] != 'classin') + if ($action != 'classin') { print '
'; print $langs->trans('Project'); print 'id.'">'; print img_edit($langs->trans('SetProject'),1); @@ -804,7 +819,7 @@ elseif ($fichinterid) } print '
'; print ''; - if ($_GET['action'] == 'classin') + if ($action == 'classin') { $html->form_project($_SERVER['PHP_SELF'].'?id='.$fichinter->id, $fichinter->socid, $fichinter->fk_project,'projectid'); } @@ -854,7 +869,7 @@ elseif ($fichinterid) $var=!$var; // Ligne en mode visu - if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid) + if ($action != 'editline' || $_GET['ligne'] != $objp->rowid) { print ''; print ''; @@ -909,7 +924,7 @@ elseif ($fichinterid) } // 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 'rowid.'" method="post">'; print ''; @@ -951,7 +966,7 @@ elseif ($fichinterid) /* * 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 '
'; @@ -1019,19 +1034,19 @@ elseif ($fichinterid) if ($user->societe_id == 0) { - if ($_GET['action'] != 'editdescription') + if ($action != 'editdescription') { // Validate if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) { - print ''.$langs->trans("Valid").''; } // Modify if ($fichinter->statut == 1 && $user->rights->ficheinter->creer) { - print ''.$langs->trans("Modify").''; } @@ -1044,38 +1059,38 @@ elseif ($fichinterid) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->ficheinter->ficheinter_advance->send) { - print ''.$langs->trans('SendByMail').''; + print ''.$langs->trans('SendByMail').''; } else print ''.$langs->trans('SendByMail').''; } } - - //Invoicing - if ($conf->global->MAIN_FEATURES_LEVEL>=2) + + // Invoicing + if ($conf->facture->enabled && $fichinter->statut > 0) { - if ($conf->facture->enabled && $fichinter->statut > 0) - { - $langs->load("bills"); - if ($fichinter->statut < 2) - { - if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; - else print ''.$langs->trans("CreateBill").''; - } - - if ($fichinter->statut != 2) + $langs->load("bills"); + if ($fichinter->statut < 2) + { + if ($user->rights->facture->creer) print ''.$langs->trans("CreateBill").''; + else print ''.$langs->trans("CreateBill").''; + } + + if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED)) + { + if ($fichinter->statut != 2) { - print ''.$langs->trans("ClassifyBilled").''; + print ''.$langs->trans("ClassifyBilled").''; } - } + } } // Delete if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { - print ''.$langs->trans('Delete').''; } - + } } @@ -1085,7 +1100,7 @@ elseif ($fichinterid) /* * Action presend */ - if ($_GET['action'] == 'presend') + if ($action == 'presend') { $ref = dol_sanitizeFileName($fichinter->ref); $file = $conf->ficheinter->dir_output . '/' . $ref . '/' . $ref . '.pdf'; @@ -1163,5 +1178,5 @@ elseif ($fichinterid) $db->close(); -llxFooter('$Date: 2011/07/01 16:24:44 $ - $Revision: 1.163 $'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.164 $'); ?> diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index bcbc0beba4f..9afa9447bb9 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -23,7 +23,7 @@ * \file htdocs/fichinter/index.php * \brief List of all interventions * \ingroup ficheinter - * \version $Id$ + * \version $Id: index.php,v 1.65 2011/07/02 16:48:32 eldy Exp $ */ require("../main.inc.php"); @@ -117,10 +117,11 @@ if ($result) print ''; print ''; print ''; + print ''; print ''; print ''; print "\n"; @@ -145,7 +146,8 @@ if ($result) $companystatic->id=$objp->socid; $companystatic->client=$objp->client; print $companystatic->getNomUrl(1,'',44); - print ''; + print ''; + print ''; print ''; print '\n"; print ''; @@ -171,5 +173,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.65 $'); ?> diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 8fc6001ac68..72894a685c4 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/fourn/commande/fiche.php * \ingroup 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"); @@ -559,7 +559,7 @@ if ($action == 'create') } $id=$orderid; - + $db->commit(); } else @@ -685,7 +685,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P $result=$mailfile->sendfile(); 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; @@ -1545,5 +1545,5 @@ if ($id > 0 || ! empty($ref)) $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.230 $'); ?> diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 62fafb2893f..561e484a7ba 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -25,7 +25,7 @@ * \file htdocs/fourn/facture/fiche.php * \ingroup facture, fournisseur * \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"); @@ -738,7 +738,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] $result=$mailfile->sendfile(); 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; @@ -1916,5 +1916,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.259 $'); ?> diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php index 8fbc9653cff..48f9bff6b9c 100644 --- a/htdocs/lib/CMailFile.class.php +++ b/htdocs/lib/CMailFile.class.php @@ -25,7 +25,7 @@ /** * \file htdocs/lib/CMailFile.class.php * \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 Eric Seigne * \author Laurent Destailleur. @@ -416,7 +416,7 @@ class CMailFile dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); $res=false; } - + if ($res) { 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-Transfer-Encoding: 8bit".$this->eol; - + dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out); return $out; } @@ -649,7 +649,7 @@ class CMailFile global $conf; $out=''; - + if ($this->atleastoneimage) { $out.= "--" . $this->mixed_boundary . $this->eol; @@ -661,7 +661,7 @@ class CMailFile { $out.= "--" . $this->mixed_boundary . $this->eol; } - + if ($this->msgishtml) { // Check if html header already in message @@ -680,7 +680,7 @@ class CMailFile if ($this->msgishtml) { - if ($this->atleastoneimage) + if ($this->atleastoneimage) { $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 @@ -697,7 +697,7 @@ class CMailFile $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; $out.= $this->eol.$strContent.$this->eol; } - + $out.= $this->eol; return $out; @@ -940,7 +940,7 @@ class CMailFile /** * Return an address for SMTP protocol * - * @param adresses Example: 'John Doe ' or 'john@doe.com' + * @param adresses Example: 'John Doe ' or 'john@doe.com' * @param format 0=Auto, 1=emails with <>, 2=emails without <> * @param encode 1=Encode name to RFC2822 * @return string If format 1: '' or 'John Doe ' diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 7f7995178a9..71561d53c57 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -29,7 +29,7 @@ * \file htdocs/lib/functions.lib.php * \brief A set of functions for Dolibarr * 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 @@ -3842,7 +3842,12 @@ function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb else if ($mesgstring && preg_match('/class="error"/i',$mesgstring)) $iserror++; if ($style=='error') $iserror++; - if ($iserror) print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); + if ($iserror) + { + $mesgstring=preg_replace('/
/','',$mesgstring); + $mesgstring=preg_replace('/<\/div>/','',$mesgstring); + print get_htmloutput_mesg($mesgstring,$mesgarray,'error',$keepembedded); + } else print get_htmloutput_mesg($mesgstring,$mesgarray,'ok',$keepembedded); }
'; print ''; - print ''; - print ''; + print ''; + print ''; print '   
'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.ConvertSecondToTime($objp->duree).'