Ajout envoi des détails

This commit is contained in:
Rodolphe Quiedeville 2006-02-08 09:45:18 +00:00
parent f50f4ee1bd
commit 80b26d6333

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com>
* *
* 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
@ -22,12 +22,11 @@
*/ */
/** /**
\file htdocs/compta/facture.php \file htdocs/telephonie/client/facture.php
\ingroup facture \ingroup telephonie/facture
\brief Page de création d'une facture \brief Page de visualisation d'une facture
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
$user->getrights('facture'); $user->getrights('facture');
@ -40,7 +39,8 @@ $warning_delay=31*24*60*60; // Delai affichage warning retard (si retard paiemen
require_once DOL_DOCUMENT_ROOT."/facture.class.php"; require_once DOL_DOCUMENT_ROOT."/facture.class.php";
require_once DOL_DOCUMENT_ROOT."/paiement.class.php"; require_once DOL_DOCUMENT_ROOT."/paiement.class.php";
require_once DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"; require_once DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php";
include_once DOL_DOCUMENT_ROOT."/contact.class.php";
include_once DOL_DOCUMENT_ROOT."/actioncomm.class.php";
if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); }
@ -52,10 +52,6 @@ if ($user->societe_id > 0)
$socidp = $user->societe_id; $socidp = $user->societe_id;
} }
// Nombre de ligne pour choix de produit/service prédéfinis
$NBLINES=4;
/* /*
* Action envoi de mail * Action envoi de mail
*/ */
@ -117,6 +113,21 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
$filename[1] = $_FILES['addedfile']['name']; $filename[1] = $_FILES['addedfile']['name'];
$mimetype[1] = $_FILES['addedfile']['type']; $mimetype[1] = $_FILES['addedfile']['type'];
$dir = $conf->facture->dir_output . "/" . $fac->ref . "/";
$handle=opendir($dir);
$ifi = 2;
while (($dfile = readdir($handle))!==false)
{
if (is_readable($dir.$dfile) && substr($dfile, -10) == 'detail.pdf')
{
$filepath[$ifi] = $conf->facture->dir_output . "/" . $fac->ref . "/" . $dfile;
$filename[$ifi] = $dfile;
$mimetype[$ifi] = "application/pdf";
$ifi++;
}
}
// Envoi de la facture // Envoi de la facture
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc);
@ -125,8 +136,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
$msg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.</div>'; $msg='<div class="ok">'.$langs->trans("MailSuccessfulySent",$from,$sendto).'.</div>';
// Insertion action // Insertion action
include_once("../contact.class.php");
include_once("../actioncomm.class.php");
$actioncomm = new ActionComm($db); $actioncomm = new ActionComm($db);
$actioncomm->type_id = $actiontypeid; $actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2; $actioncomm->label = $actionmsg2;
@ -174,16 +184,10 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance')
} }
} }
llxHeader('',$langs->trans("Bill"),'Facture'); llxHeader('',$langs->trans("Bill"),'Facture');
$html = new Form($db); $html = new Form($db);
if ($_GET["facid"] > 0) if ($_GET["facid"] > 0)
{ {
if ($msg) print "$msg<br>"; if ($msg) print "$msg<br>";
@ -464,8 +468,6 @@ if ($_GET["facid"] > 0)
} }
$total = $total + ($objp->qty * $objp->price); $total = $total + ($objp->qty * $objp->price);
$i++; $i++;
} }
@ -476,17 +478,13 @@ if ($_GET["facid"] > 0)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
/* /*
* Ajouter une ligne * Ajouter une ligne
*/ */
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
/* /*
* Boutons actions * Boutons actions
*/ */
@ -495,10 +493,6 @@ if ($_GET["facid"] > 0)
{ {
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
// Envoyer // Envoyer
if ($fac->statut == 1 && $user->rights->facture->envoyer) if ($fac->statut == 1 && $user->rights->facture->envoyer)
{ {
@ -506,14 +500,12 @@ if ($_GET["facid"] > 0)
} }
// Envoyer une relance // Envoyer une relance
/*
if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer) if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer)
{ {
print " <a class=\"tabAction\" href=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id&amp;action=prerelance\">".$langs->trans("SendRemind")."</a>\n"; print " <a class=\"tabAction\" href=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id&amp;action=prerelance\">".$langs->trans("SendRemind")."</a>\n";
} }
*/
print "</div>\n"; print "</div>\n";
@ -546,7 +538,6 @@ if ($_GET["facid"] > 0)
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>'; print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '</tr>'; print '</tr>';
$dir = $conf->facture->dir_output . "/" . $facref . "/"; $dir = $conf->facture->dir_output . "/" . $facref . "/";
$handle=opendir($dir); $handle=opendir($dir);
@ -736,15 +727,12 @@ if ($_GET["facid"] > 0)
} }
} }
} }
else else
{ {
/* Facture non trouvée */ /* Facture non trouvée */
print $langs->trans("ErrorBillNotFound",$_GET["facid"]); print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
} }
} }
$db->close(); $db->close();