diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='*.bkp' htdocs.bkp/fichinter/fiche.php htdocs/fichinter/fiche.php --- htdocs.bkp/fichinter/fiche.php 2011-01-17 02:42:31.000000000 +0100 +++ htdocs/fichinter/fiche.php 2011-04-27 21:42:34.000000000 +0200 @@ -58,6 +58,8 @@ $fichinterid=$fichinter->id; } +if (isset($_GET["msg"])) { $mesg=$_GET["msg"]; } + // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); @@ -423,6 +425,163 @@ } + + + +/* + * Send mail (from comm/propal/fiche.php ) + */ +if ($_POST['action'] == 'send' && ! $_POST['cancel']) +{ + $langs->load('mails'); + + $fichinter = new Fichinter($db); + if ( $fichinter->fetch($_POST['fichinter_id']) ) + { + $ficheinterref = dol_sanitizeFileName($fichinter->ref); + $file = $conf->ficheinter->dir_output . '/' . $ficheinterref . '/' . $ficheinterref . '.pdf'; + + if (is_readable($file)) + { + $fichinter->fetch_thirdparty(); + + if ($_POST['sendto']) + { + // Le destinataire a ete fourni via le champ libre + $sendto = $_POST['sendto']; + $sendtoid = 0; + } + elseif ($_POST['receiver']) + { + // Le destinataire a ete fourni via la liste deroulante + if ($_POST['receiver'] < 0) // Id du tiers + { + $sendto = $fichinter->client->email; + $sendtoid = 0; + } + else // Id du contact + { + $sendto = $fichinter->client->contact_get_email($_POST['receiver']); + $sendtoid = $_POST['receiver']; + } + } + + if (strlen($sendto)) + { + $langs->load("commercial"); + + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; + + if ($_POST['action'] == 'send') + { + if (strlen($_POST['subject'])) $subject = $_POST['subject']; + else $subject = $langs->transnoentities('Intervention').' '.$fichinter->ref; + $actiontypecode='AC_FICH'; + $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; + if ($message) + { + $actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n"; + $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; + $actionmsg.=$message; + } + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); + } + + // Create form object + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); + $formmail = new FormMail($db); + + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // 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) + { + $mesg='
'; /* * Built documents diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='*.bkp' htdocs.bkp/includes/modules/modFicheinter.class.php htdocs/includes/modules/modFicheinter.class.php --- htdocs.bkp/includes/modules/modFicheinter.class.php 2011-01-17 02:43:23.000000000 +0100 +++ htdocs/includes/modules/modFicheinter.class.php 2011-04-27 21:48:09.000000000 +0200 @@ -127,6 +127,13 @@ $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; + $r++; + $this->rights[$r][0] = 68; + $this->rights[$r][1] = 'Envoyer les fiches d\'intervention'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'envoyer'; + //Exports //-------- $r=1; diff -BNaur --exclude=CVS --exclude='*.patch' --exclude='.#*' --exclude='*~' --exclude='*.rej' --exclude='*.orig' --exclude='*.bak' --exclude=conf.php --exclude=documents --exclude='*.bkp' htdocs.bkp/langs/fr_FR/interventions.lang htdocs/langs/fr_FR/interventions.lang --- htdocs.bkp/langs/fr_FR/interventions.lang 2010-08-04 01:23:53.000000000 +0200 +++ htdocs/langs/fr_FR/interventions.lang 2011-04-27 19:58:18.000000000 +0200 @@ -45,3 +45,5 @@ ArcticNumRefModelError=Activation impossible PacificNumRefModelDesc1=Renvoie le numéro sous la forme %syymm-nnnn où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0 PacificNumRefModelError=Une facture commençant par $syymm existe en base et est incompatible avec cette numérotation. Supprimez la ou renommez la pour activer ce module. +SendInterventionByMail=Envoi de la fiche d'intervention par mail +SendInterventionRef=Envoi Intervention %s |