Ajout de l'email du tiers dans destinataire d'envoi

This commit is contained in:
Laurent Destailleur 2006-11-29 22:03:28 +00:00
parent 887695c8a0
commit 5ed4be7107
10 changed files with 323 additions and 204 deletions

View File

@ -53,7 +53,7 @@ require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } if (isset($_GET["msg"])) { $mesg=urldecode($_GET["mesg"]); }
$year=isset($_GET["year"])?$_GET["year"]:""; $year=isset($_GET["year"])?$_GET["year"]:"";
$month=isset($_GET["month"])?$_GET["month"]:""; $month=isset($_GET["month"])?$_GET["month"]:"";
@ -196,7 +196,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
} }
else else
{ {
$msg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",$_POST['copie_propal']).'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",$_POST['copie_propal']).'</div>';
} }
} }
else else
@ -245,7 +245,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
} }
else else
{ {
$msg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
$error=1; $error=1;
} }
} }
@ -297,26 +297,37 @@ if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer)
if ($_POST['action'] == 'send') if ($_POST['action'] == 'send')
{ {
$langs->load('mails'); $langs->load('mails');
$propal= new Propal($db); $propal= new Propal($db);
if ( $propal->fetch($_POST['propalid']) ) if ( $propal->fetch($_POST['propalid']) )
{ {
$propalref = sanitize_string($propal->ref); $propalref = sanitize_string($propal->ref);
$file = $conf->propal->dir_output . '/' . $propalref . '/' . $propalref . '.pdf'; $file = $conf->propal->dir_output . '/' . $propalref . '/' . $propalref . '.pdf';
if (is_readable($file)) if (is_readable($file))
{ {
$soc = new Societe($db, $propal->socid); $propal->fetch_client();
if ($_POST['sendto'])
{ if ($_POST['sendto'])
// Le destinataire a été fourni via le champ libre {
$sendto = $_POST['sendto']; // Le destinataire a été fourni via le champ libre
$sendtoid = 0; $sendto = $_POST['sendto'];
} $sendtoid = 0;
elseif ($_POST['receiver']) }
{ elseif ($_POST['receiver'])
// Le destinataire a été fourni via la liste déroulante {
$sendto = $soc->contact_get_email($_POST['receiver']); // Le destinataire a été fourni via la liste déroulante
$sendtoid = $_POST['receiver']; if ($_POST['receiver'] < 0) // Id du tiers
} {
$sendto = $propal->client->email;
$sendtoid = 0;
}
else // Id du contact
{
$sendto = $propal->client->contact_get_email($_POST['receiver']);
$sendtoid = $_POST['receiver'];
}
}
if (strlen($sendto)) if (strlen($sendto))
{ {
@ -356,54 +367,82 @@ if ($_POST['action'] == 'send')
$filename[1] = $_FILES['addedfile']['name']; $filename[1] = $_FILES['addedfile']['name'];
$mimetype[1] = $_FILES['addedfile']['type']; $mimetype[1] = $_FILES['addedfile']['type'];
} }
// Envoi de la propal // Envoi de la propal
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
if ($mailfile->sendfile()) if ($mailfile->error)
{ {
$msg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="error">'.$mailfile->error.'</div>';
// Insertion action }
include_once(DOL_DOCUMENT_ROOT."/contact.class.php"); else
$actioncomm = new ActionComm($db); {
$actioncomm->type_id = $actiontypeid; $result=$mailfile->sendfile();
$actioncomm->label = $actionmsg2; if ($result)
$actioncomm->note = $actionmsg; {
$actioncomm->date = time(); // L'action est faite maintenant $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
$actioncomm->percent = 100;
$actioncomm->contact = new Contact($db,$sendtoid); // Insertion action
$actioncomm->societe = new Societe($db,$propal->socid); require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
$actioncomm->user = $user; // User qui a fait l'action require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
$actioncomm->propalrowid = $propal->id; $actioncomm = new ActionComm($db);
$ret=$actioncomm->add($user); // User qui saisi l'action $actioncomm->type_id = $actiontypeid;
if ($ret < 0) $actioncomm->label = $actionmsg2;
{ $actioncomm->note = $actionmsg;
dolibarr_print_error($db); $actioncomm->date = time(); // L'action est faite maintenant
} $actioncomm->percent = 100;
else $actioncomm->contact = new Contact($db,$sendtoid);
{ $actioncomm->societe = new Societe($db,$propal->socid);
// Renvoie sur la fiche $actioncomm->user = $user; // User qui a fait l'action
Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&msg='.urlencode($msg)); $actioncomm->propalrowid = $propal->id;
exit;
} $ret=$actioncomm->add($user); // User qui saisit l'action
} if ($ret < 0)
else {
{ dolibarr_print_error($db);
$msg='<div class="error">'.$langs->trans('ErrorFailedToSendMail',$from,$sendto).' - '.$actioncomm->error.'</div>'; }
} else
{
// Renvoie sur la fiche
Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&msg='.urlencode($mesg));
exit;
}
}
else
{
$langs->load("other");
$mesg='<div class="error">';
if ($mailfile->error)
{
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
$mesg.='<br>'.$mailfile->error;
}
else
{
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
}
$mesg.='</div>';
}
}
} }
else else
{ {
$msg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>'; $langs->load("other");
dolibarr_syslog('Le mail du destinataire est vide'); $mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
dolibarr_syslog('Recipient email is empty');
} }
} }
else else
{ {
dolibarr_syslog('Impossible de lire :'.$file); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
dolibarr_syslog('Failed to read file: '.$file);
} }
} }
else else
{ {
dolibarr_syslog('Impossible de lire les données de la propale. Le fichier propal n\'a peut-être pas été généré.'); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>';
dolibarr_syslog('Impossible de lire les données de la facture. Le fichier facture n\'a peut-être pas été généré.');
} }
} }
@ -677,7 +716,7 @@ $html = new Form($db);
*/ */
if ($_GET['propalid'] > 0) if ($_GET['propalid'] > 0)
{ {
if ($msg) print "$msg<br>"; if ($mesg) print "$mesg<br>";
$propal = new Propal($db); $propal = new Propal($db);
@ -1648,7 +1687,7 @@ if ($conf->expedition->enabled)
print_titre($langs->trans('SendPropalByMail')); print_titre($langs->trans('SendPropalByMail'));
$liste[0]="&nbsp;"; $liste[0]="&nbsp;";
foreach ($societe->contact_email_array() as $key=>$value) foreach ($societe->thirdparty_and_contact_email_array() as $key=>$value)
{ {
$liste[$key]=$value; $liste[$key]=$value;
} }
@ -1674,6 +1713,8 @@ if ($conf->expedition->enabled)
$formmail->param['returnurl']=DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id; $formmail->param['returnurl']=DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
$formmail->show_form(); $formmail->show_form();
print '<br>';
} }
} }

View File

@ -131,7 +131,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
} }
else else
{ {
$msg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
$error=1; $error=1;
} }
} }
@ -516,26 +516,37 @@ if ($action=='remove_file')
if ($_POST['action'] == 'send') if ($_POST['action'] == 'send')
{ {
$langs->load('mails'); $langs->load('mails');
$commande= new Commande($db); $commande= new Commande($db);
if ( $commande->fetch($_POST['orderid']) ) if ( $commande->fetch($_POST['orderid']) )
{ {
$orderref = sanitize_string($commande->ref); $orderref = sanitize_string($commande->ref);
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf'; $file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
if (is_readable($file)) if (is_readable($file))
{ {
$soc = new Societe($db, $commande->socid); $commande->fetch_client();
if ($_POST['sendto'])
{ if ($_POST['sendto'])
// Le destinataire a été fourni via le champ libre {
$sendto = $_POST['sendto']; // Le destinataire a été fourni via le champ libre
$sendtoid = 0; $sendto = $_POST['sendto'];
} $sendtoid = 0;
elseif ($_POST['receiver']) }
{ elseif ($_POST['receiver'])
// Le destinataire a été fourni via la liste déroulante {
$sendto = $soc->contact_get_email($_POST['receiver']); // Le destinataire a été fourni via la liste déroulante
$sendtoid = $_POST['receiver']; if ($_POST['receiver'] < 0) // Id du tiers
} {
$sendto = $commande->client->email;
$sendtoid = 0;
}
else // Id du contact
{
$sendto = $commande->client->contact_get_email($_POST['receiver']);
$sendtoid = $_POST['receiver'];
}
}
if (strlen($sendto)) if (strlen($sendto))
{ {
@ -575,54 +586,82 @@ if ($_POST['action'] == 'send')
$filename[1] = $_FILES['addedfile']['name']; $filename[1] = $_FILES['addedfile']['name'];
$mimetype[1] = $_FILES['addedfile']['type']; $mimetype[1] = $_FILES['addedfile']['type'];
} }
// Envoi de la commande // Envoi de la commande
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
if ($mailfile->sendfile()) if ($mailfile->error)
{ {
$msg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="error">'.$mailfile->error.'</div>';
// Insertion action }
include_once(DOL_DOCUMENT_ROOT."/contact.class.php"); else
$actioncomm = new ActionComm($db); {
$actioncomm->type_id = $actiontypeid; $result=$mailfile->sendfile();
$actioncomm->label = $actionmsg2; if ($result)
$actioncomm->note = $actionmsg; {
$actioncomm->date = time(); // L'action est faite maintenant $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
$actioncomm->percent = 100;
$actioncomm->contact = new Contact($db,$sendtoid); // Insertion action
$actioncomm->societe = new Societe($db,$commande->socid); require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
$actioncomm->user = $user; // User qui a fait l'action require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
$actioncomm->orderrowid = $commande->id; $actioncomm = new ActionComm($db);
$ret=$actioncomm->add($user); // User qui saisi l'action $actioncomm->type_id = $actiontypeid;
if ($ret < 0) $actioncomm->label = $actionmsg2;
{ $actioncomm->note = $actionmsg;
dolibarr_print_error($db); $actioncomm->date = time(); // L'action est faite maintenant
} $actioncomm->percent = 100;
else $actioncomm->contact = new Contact($db,$sendtoid);
{ $actioncomm->societe = new Societe($db,$commande->socid);
// Renvoie sur la fiche $actioncomm->user = $user; // User qui a fait l'action
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&msg='.urlencode($msg)); $actioncomm->orderrowid = $commande->id;
exit;
} $ret=$actioncomm->add($user); // User qui saisit l'action
} if ($ret < 0)
else {
{ dolibarr_print_error($db);
$msg='<div class="error">'.$langs->trans('ErrorFailedToSendMail',$from,$sendto).' - '.$actioncomm->error.'</div>'; }
} else
{
// Renvoie sur la fiche
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&msg='.urlencode($mesg));
exit;
}
}
else
{
$langs->load("other");
$mesg='<div class="error">';
if ($mailfile->error)
{
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
$mesg.='<br>'.$mailfile->error;
}
else
{
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
}
$mesg.='</div>';
}
}
} }
else else
{ {
$msg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>'; $langs->load("other");
dolibarr_syslog('Le mail du destinataire est vide'); $mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
dolibarr_syslog('Recipient email is empty');
} }
} }
else else
{ {
dolibarr_syslog('Impossible de lire :'.$file); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
dolibarr_syslog('Failed to read file: '.$file);
} }
} }
else else
{ {
dolibarr_syslog('Impossible de lire les données de la commande. Le fichier commande n\'a peut-être pas été généré.'); $langs->load("other");
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'</div>';
dolibarr_syslog('Impossible de lire les données de la facture. Le fichier facture n\'a peut-être pas été généré.');
} }
} }
@ -941,15 +980,17 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
} }
} }
else else
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
{ {
/* *************************************************************************** */
/* */
/* Mode vue et edition */
/* */
/* *************************************************************************** */
$id = $_GET['id']; $id = $_GET['id'];
if ($id > 0) if ($id > 0)
{ {
if ($mesg) print $mesg.'<br>';
$commande = new Commande($db); $commande = new Commande($db);
if ( $commande->fetch($_GET['id']) > 0) if ( $commande->fetch($_GET['id']) > 0)
{ {
@ -1840,7 +1881,7 @@ else
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
$liste[0]="&nbsp;"; $liste[0]="&nbsp;";
foreach ($soc->contact_email_array() as $key=>$value) foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value)
{ {
$liste[$key]=$value; $liste[$key]=$value;
} }
@ -1866,8 +1907,9 @@ else
$formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; $formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
$formmail->show_form(); $formmail->show_form();
}
print '<br>';
}
} }
else else
{ {

View File

@ -819,17 +819,27 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
if (is_readable($file)) if (is_readable($file))
{ {
$soc = new Societe($db, $fac->socid); $fac->fetch_client();
if ($_POST['sendto']) { if ($_POST['sendto'])
{
// Le destinataire a été fourni via le champ libre // Le destinataire a été fourni via le champ libre
$sendto = $_POST['sendto']; $sendto = $_POST['sendto'];
$sendtoid = 0; $sendtoid = 0;
} }
elseif ($_POST['receiver']) { elseif ($_POST['receiver'])
{
// Le destinataire a été fourni via la liste déroulante // Le destinataire a été fourni via la liste déroulante
$sendto = $soc->contact_get_email($_POST['receiver']); if ($_POST['receiver'] < 0) // Id du tiers
$sendtoid = $_POST['receiver']; {
$sendto = $fac->client->email;
$sendtoid = 0;
}
else // Id du contact
{
$sendto = $fac->client->contact_get_email($_POST['receiver']);
$sendtoid = $_POST['receiver'];
}
} }
if (strlen($sendto)) if (strlen($sendto))
@ -877,9 +887,12 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$filepath[0] = $file; $filepath[0] = $file;
$filename[0] = $fac->ref.'.pdf'; $filename[0] = $fac->ref.'.pdf';
$mimetype[0] = 'application/pdf'; $mimetype[0] = 'application/pdf';
$filepath[1] = $_FILES['addedfile']['tmp_name']; if ($_FILES['addedfile']['tmp_name'])
$filename[1] = $_FILES['addedfile']['name']; {
$mimetype[1] = $_FILES['addedfile']['type']; $filepath[1] = $_FILES['addedfile']['tmp_name'];
$filename[1] = $_FILES['addedfile']['name'];
$mimetype[1] = $_FILES['addedfile']['type'];
}
// Envoi de la facture // Envoi de la facture
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
@ -889,7 +902,8 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
} }
else else
{ {
if ($mailfile->sendfile()) $result=$mailfile->sendfile();
if ($result)
{ {
$mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>'; $mesg='<div class="ok">'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.</div>';
@ -900,7 +914,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$actioncomm->type_id = $actiontypeid; $actioncomm->type_id = $actiontypeid;
$actioncomm->label = $actionmsg2; $actioncomm->label = $actionmsg2;
$actioncomm->note = $actionmsg; $actioncomm->note = $actionmsg;
$actioncomm->date = time(); $actioncomm->date = time(); // L'action est faite maintenant
$actioncomm->percent = 100; $actioncomm->percent = 100;
$actioncomm->contact = new Contact($db,$sendtoid); $actioncomm->contact = new Contact($db,$sendtoid);
$actioncomm->societe = new Societe($db,$fac->socid); $actioncomm->societe = new Societe($db,$fac->socid);
@ -908,7 +922,6 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$actioncomm->facid = $fac->id; $actioncomm->facid = $fac->id;
$ret=$actioncomm->add($user); // User qui saisit l'action $ret=$actioncomm->add($user); // User qui saisit l'action
if ($ret < 0) if ($ret < 0)
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
@ -924,8 +937,15 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
{ {
$langs->load("other"); $langs->load("other");
$mesg='<div class="error">'; $mesg='<div class="error">';
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); if ($mailfile->error)
if ($mailfile->error) $mesg.='<br>'.$mailfile->error; {
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
$mesg.='<br>'.$mailfile->error;
}
else
{
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
}
$mesg.='</div>'; $mesg.='</div>';
} }
} }
@ -936,7 +956,6 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>'; $mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
dolibarr_syslog('Recipient email is empty'); dolibarr_syslog('Recipient email is empty');
} }
} }
else else
{ {
@ -1571,15 +1590,14 @@ if ($_GET['action'] == 'create')
} }
else else
{ {
/* *************************************************************************** */
/* */
/* Fiche en mode visu */
/* */
/* *************************************************************************** */
$id = $_GET['facid']; $id = $_GET['facid'];
if ($id > 0) if ($id > 0)
{ {
/* *************************************************************************** */
/* */
/* Fiche en mode visu */
/* */
/* *************************************************************************** */
if ($mesg) print $mesg.'<br>'; if ($mesg) print $mesg.'<br>';
$fac = New Facture($db); $fac = New Facture($db);
@ -2772,7 +2790,7 @@ else
print_titre($langs->trans('SendBillByMail')); print_titre($langs->trans('SendBillByMail'));
$liste[0]='&nbsp;'; $liste[0]='&nbsp;';
foreach ($soc->contact_email_array() as $key=>$value) foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value)
{ {
$liste[$key]=$value; $liste[$key]=$value;
} }
@ -2828,7 +2846,7 @@ else
print_titre($langs->trans('SendReminderBillByMail')); print_titre($langs->trans('SendReminderBillByMail'));
$liste[0]='&nbsp;'; $liste[0]='&nbsp;';
foreach ($soc->contact_email_array() as $key=>$value) foreach ($soc->thirdparty_and_contact_email_array() as $key=>$value)
{ {
$liste[$key]=$value; $liste[$key]=$value;
} }
@ -2857,7 +2875,6 @@ else
print '<br>'; print '<br>';
} }
} }
else else
{ {

View File

@ -28,10 +28,11 @@
\brief Page des societes \brief Page des societes
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require("../../tva.class.php"); require("../../tva.class.php");
$langs->load("other");
$year=$_GET["year"]; $year=$_GET["year"];
if ($year == 0 ) if ($year == 0 )
{ {

View File

@ -1034,7 +1034,7 @@ class Form
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libellé par défaut // Si traduction existe, on l'utilise, sinon on prend le libellé par défaut
$libelle=($langs->trans("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->trans("PaymentTypeShort".$obj->code):($obj->libelle!='-'?$obj->libelle:'')); $libelle=($langs->trans("PaymentModeShort".$obj->code)!=("PaymentModeShort".$obj->code)?$langs->trans("PaymentModeShort".$obj->code):($obj->libelle!='-'?$obj->libelle:''));
$this->cache_types_paiements_code[$obj->id]=$obj->code; $this->cache_types_paiements_code[$obj->id]=$obj->code;
$this->cache_types_paiements_libelle[$obj->id]=$libelle; $this->cache_types_paiements_libelle[$obj->id]=$libelle;
$this->cache_types_paiements_type[$obj->id]=$obj->type; $this->cache_types_paiements_type[$obj->id]=$obj->type;

View File

@ -78,7 +78,7 @@ class pdf_paiement
$pdf->Text(11,$this->tab_top + 6,'Date'); $pdf->Text(11,$this->tab_top + 6,'Date');
$pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10);
$pdf->Text(42, $this->tab_top + 6, $langs->trans("PaymentType")); $pdf->Text(42, $this->tab_top + 6, $langs->trans("PaymentMode"));
$pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10); $pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10);
$pdf->Text(82, $this->tab_top + 6, $langs->trans("Invoice")); $pdf->Text(82, $this->tab_top + 6, $langs->trans("Invoice"));

View File

@ -490,6 +490,7 @@ print '</td></tr></table>';
*/ */
$boxarray=$infobox->listboxes("0",$user); // 0=valeur pour la page accueil $boxarray=$infobox->listboxes("0",$user); // 0=valeur pour la page accueil
$boxjavascriptids=array(); $boxjavascriptids=array();
//print_r($boxarray);
// Gestion deplacement des boxes // Gestion deplacement des boxes
if (eregi('boxobject_([0-9]+)',$_GET["switchfrom"],$regfrom) if (eregi('boxobject_([0-9]+)',$_GET["switchfrom"],$regfrom)

View File

@ -47,6 +47,7 @@ Town=Town
Web=Web Web=Web
Birthday=Birthday Birthday=Birthday
VATIsUsed=Using VAT VATIsUsed=Using VAT
ThirdPartyEMail=%s
##### Professionnal ID ##### ##### Professionnal ID #####
ProfId1=Professional ID 1 ProfId1=Professional ID 1
ProfId2=Professional ID 2 ProfId2=Professional ID 2

View File

@ -47,6 +47,7 @@ Town=Ville
Web=Web Web=Web
Birthday=Date de naissance Birthday=Date de naissance
VATIsUsed=Assujéti à TVA VATIsUsed=Assujéti à TVA
ThirdPartyEMail=%s
##### Professionnal ID ##### ##### Professionnal ID #####
ProfId1=ID professionnel 1 ProfId1=ID professionnel 1
ProfId2=ID professionnel 2 ProfId2=ID professionnel 2

View File

@ -1148,76 +1148,91 @@ class Societe
} }
/**
* \brief Renvoie la liste des contacts emails existant pour la société
* \return array tableau des contacts emails
*/
function contact_email_array()
{
$contact_email = array();
$sql = "SELECT idp, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = '$this->id'"; /**
* \brief Renvoie la liste des contacts emails existant pour la sociét
* \return array tableau des contacts emails
*/
function thirdparty_and_contact_email_array()
{
global $langs;
if ($this->db->query($sql) ) $contact_email = $this->contact_email_array();
{ if ($this->email)
$nump = $this->db->num_rows(); {
// TODO: Tester si email non deja présent dans tableau contact
$contact_email[-1]=$langs->trans("ThirdParty").': '.dolibarr_trunc($this->nom,16)." &lt;".$this->email."&gt;";;
}
return $contact_email;
}
if ($nump) /**
{ * \brief Renvoie la liste des contacts emails existant pour la société
$i = 0; * \return array tableau des contacts emails
while ($i < $nump) */
{ function contact_email_array()
$obj = $this->db->fetch_object(); {
$contact_email = array();
$contact_email[$obj->idp] = "$obj->firstname $obj->name &lt;$obj->email&gt;"; $sql = "SELECT idp, email, name, firstname";
$i++; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
} $sql.= " WHERE fk_soc = '".$this->id."'";
} $resql=$this->db->query($sql);
return $contact_email; if ($resql)
} {
else $nump = $this->db->num_rows($resql);
{ if ($nump)
dolibarr_print_error($this->db); {
} $i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object($resql);
$contact_email[$obj->idp] = trim($obj->firstname." ".$obj->name)." &lt;".$obj->email."&gt;";
$i++;
}
}
}
else
{
dolibarr_print_error($this->db);
}
return $contact_email;
}
}
/** /**
* \brief Renvoie la liste des contacts de cette société * \brief Renvoie la liste des contacts de cette sociét
* \return array tableau des contacts * \return array tableau des contacts
*/ */
function contact_array() function contact_array()
{ {
$contacts = array(); $contacts = array();
$sql = "SELECT idp, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = '$this->id'"; $sql = "SELECT idp, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = '$this->id'";
$resql=$this->db->query($sql);
if ($this->db->query($sql) ) if ($resql)
{ {
$nump = $this->db->num_rows(); $nump = $this->db->num_rows($resql);
if ($nump)
if ($nump) {
{ $i = 0;
$i = 0; while ($i < $nump)
while ($i < $nump) {
{ $obj = $this->db->fetch_object($resql);
$obj = $this->db->fetch_object(); $contacts[$obj->idp] = "$obj->firstname $obj->name";
$i++;
$contacts[$obj->idp] = "$obj->firstname $obj->name"; }
$i++; }
} }
} else
return $contacts; {
} dolibarr_print_error($this->db);
else }
{ return $contacts;
dolibarr_print_error($this->db); }
}
}
/** /**
* \brief Renvoie l'email d'un contact par son id * \brief Renvoie l'email d'un contact depuis son id
* \param rowid id du contact * \param rowid id du contact
* \return string email du contact * \return string email du contact
*/ */