Qual: Removed TODO, deprecated code and deprecated properties. This also

fix missing combo box of contacts onto CC.
This commit is contained in:
Laurent Destailleur 2013-02-12 17:08:21 +01:00
parent 6bbac00c22
commit 3eb485d521
8 changed files with 123 additions and 153 deletions

View File

@ -2151,12 +2151,11 @@ else
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -2418,12 +2418,11 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=GETPOST('sendto')?GETPOST('sendto'):1; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -3403,12 +3403,11 @@ else if ($id > 0 || ! empty($ref))
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__'); $formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -49,6 +49,7 @@ class FormMail
var $withto; var $withto;
var $withtofree; var $withtofree;
var $withtocc; var $withtocc;
var $withtoccc;
var $withtopic; var $withtopic;
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
var $withbody; var $withbody;
@ -428,23 +429,11 @@ class FormMail
else else
{ {
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />'; $out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
if (! empty($this->withto) && is_array($this->withto)) if (! empty($this->withtocc) && is_array($this->withtocc))
{ {
$out.= " ".$langs->trans("or")." "; $out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1); $out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
} }
if (! empty($this->withtoccsocid) && $this->withtoccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
{
$liste=array();
$soc=new Societe($this->db);
$soc->fetch($this->withtoccsocid);
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
{
$liste[$key]=$value;
}
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receivercc", $liste, GETPOST("receivercc"), 1);
}
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
} }
@ -462,23 +451,11 @@ class FormMail
else else
{ {
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />'; $out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
if (! empty($this->withto) && is_array($this->withto)) if (! empty($this->withtoccc) && is_array($this->withtoccc))
{ {
$out.= " ".$langs->trans("or")." "; $out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1); $out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1);
} }
if (! empty($this->withtocccsocid) && $this->withtocccsocid > 0) // deprecated. TODO Remove this. Instead, fill withto with array before calling method.
{
$liste=array();
$soc=new Societe($this->db);
$soc->fetch($this->withtosocid);
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
{
$liste[$key]=$value;
}
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receiverccc", $liste, GETPOST("receiverccc"), 1);
}
} }
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1); //if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";

View File

@ -1443,12 +1443,11 @@ else
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=GETPOST('sendto','int')?GETPOST('sendto','int'):1; $liste=array();
$formmail->withtosocid=$soc->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__'); $formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -1487,12 +1487,11 @@ else if ($id > 0 || ! empty($ref))
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=(!GETPOST('sendto','alpha'))?1:GETPOST('sendto','alpha'); $liste=array();
$formmail->withtosocid=$societe->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__'); $formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -1819,12 +1819,11 @@ if (! empty($object->id))
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$object->thirdparty->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;

View File

@ -2075,12 +2075,11 @@ else
$formmail->fromname = $user->getFullName($langs); $formmail->fromname = $user->getFullName($langs);
$formmail->frommail = $user->email; $formmail->frommail = $user->email;
$formmail->withfrom=1; $formmail->withfrom=1;
$formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; $liste=array();
$formmail->withtosocid=$societe->id; foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
$formmail->withtocc=1; $formmail->withto=GETPOST("sendto")?GETOST("sendto"):$liste;
$formmail->withtoccsocid=0; $formmail->withtocc=$liste;
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
$formmail->withtocccsocid=0;
$formmail->withtopic=$langs->trans('SendBillRef','__FACREF__'); $formmail->withtopic=$langs->trans('SendBillRef','__FACREF__');
$formmail->withfile=2; $formmail->withfile=2;
$formmail->withbody=1; $formmail->withbody=1;