mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Preview of email sent is shown
This commit is contained in:
parent
5cb43e1521
commit
f844640adf
|
|
@ -19,6 +19,7 @@ For users:
|
|||
- New: Delivery date accepts hours and minutes.
|
||||
- New: Can add a comment on stock dispatching to be save into stock movements.
|
||||
- New: Add option to send all emails sent to a bulk carbon copy.
|
||||
- New: Preview of emails sent by member module is shown.
|
||||
- Perf: Avoid reading database to determine country code after each
|
||||
page call.
|
||||
- Fix: Better Postgresql compatibility.
|
||||
|
|
|
|||
|
|
@ -253,14 +253,9 @@ print_fiche_titre($langs->trans("MembersTickets"),'','');
|
|||
|
||||
form_constantes($constantes);
|
||||
|
||||
print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
print '%DOL_MAIN_URL_ROOT%, %ID%, %PRENOM%, %NOM%, %LOGIN%, %PASSWORD%, ';
|
||||
print '%SOCIETE%, %ADRESSE%, %CP%, %VILLE%, %PAYS%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, ';
|
||||
print '%YEAR%, %MONTH%, %DAY%';
|
||||
//print '%INFOS%'; Deprecated
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
* Edition des variables globales non rattache a un theme specifique
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio
|
|||
$emetteur_nom=$_POST["chqemetteur"];
|
||||
$emetteur_banque=$_POST["chqbank"];
|
||||
|
||||
|
||||
// Check if a payment is mandatory or not
|
||||
if ($adht->cotisation) // Type adherent soumis a cotisation
|
||||
{
|
||||
if (! is_numeric($_POST["cotisation"]))
|
||||
|
|
@ -137,10 +137,13 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio
|
|||
{
|
||||
$db->commit();
|
||||
|
||||
// Envoi mail
|
||||
if ($_POST["sendmail"])
|
||||
// Send confirmation Email
|
||||
if ($adh->email && $_POST["sendmail"])
|
||||
{
|
||||
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_COTIS,$conf->global->ADHERENT_MAIL_COTIS_SUBJECT,array(),array(),array(),"","",0,-1);
|
||||
$subjecttosend=$adh->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
|
||||
$texttosend=$adh->makeSubstitution($adht->getMailOnSubscription());
|
||||
|
||||
$result=$adh->send_an_email($texttosend,$subjecttosend,array(),array(),array(),"","",0,-1);
|
||||
if ($result < 0) $errmsg=$adh->error;
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +370,7 @@ print '</table>';
|
|||
|
||||
|
||||
/*
|
||||
* Ajout d'une nouvelle cotisation
|
||||
* Add new subscription
|
||||
*/
|
||||
if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
|
|
@ -473,11 +476,23 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
|||
}
|
||||
else
|
||||
{
|
||||
$s1='<input name="sendmail" type="checkbox"'.($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?' checked="true"':'').'>';
|
||||
$s2=$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b><br>';
|
||||
$s2.=$langs->trans("MailRecipient").': <b>'.$adh->email.'</b>';
|
||||
//$s2.='<br>'.$langs->trans("Content").': '.nl2br($conf->global->ADHERENT_MAIL_COTIS);
|
||||
print $html->textwithpicto($s1,$s2,1);
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
|
||||
$subjecttosend=$adh->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
|
||||
$texttosend=$adh->makeSubstitution($adht->getMailOnSubscription());
|
||||
|
||||
$tmp='<input name="sendmail" type="checkbox"'.($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?' checked="true"':'').'>';
|
||||
$helpcontent='';
|
||||
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$adh->email.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent.=$subjecttosend."\n";
|
||||
$helpcontent.="<br>";
|
||||
$helpcontent.='<b>'.$langs->trans("Content").'</b>:<br>';
|
||||
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
||||
|
||||
print $html->textwithpicto($tmp,$helpcontent,1,'help');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -35,242 +35,296 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
|||
*/
|
||||
class AdherentType extends CommonObject
|
||||
{
|
||||
var $error;
|
||||
var $errors=array();
|
||||
var $db;
|
||||
var $table_element = 'adherent_type';
|
||||
var $error;
|
||||
var $errors=array();
|
||||
var $db;
|
||||
var $table_element = 'adherent_type';
|
||||
|
||||
var $id;
|
||||
var $libelle;
|
||||
var $statut;
|
||||
var $cotisation; // Soumis a la cotisation
|
||||
var $vote; // droit de vote
|
||||
var $note; // commentaire
|
||||
var $mail_valid; //mail envoye lors de la validation
|
||||
var $id;
|
||||
var $libelle;
|
||||
var $statut;
|
||||
var $cotisation; // Soumis a la cotisation
|
||||
var $vote; // droit de vote
|
||||
var $note; // commentaire
|
||||
var $mail_valid; //mail envoye lors de la validation
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief AdherentType
|
||||
* \param DB handler acces base de donnees
|
||||
*/
|
||||
function AdherentType($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->statut = 1;
|
||||
}
|
||||
/**
|
||||
* \brief AdherentType
|
||||
* \param DB handler acces base de donnees
|
||||
*/
|
||||
function AdherentType($DB)
|
||||
{
|
||||
$this->db = $DB ;
|
||||
$this->statut = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief print_error_list
|
||||
*/
|
||||
function print_error_list()
|
||||
{
|
||||
$num = sizeof($this->error);
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
print "<li>" . $this->error[$i];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* \brief print_error_list
|
||||
*/
|
||||
function print_error_list()
|
||||
{
|
||||
$num = sizeof($this->error);
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
print "<li>" . $this->error[$i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui permet de creer le status de l'adherent
|
||||
* \param userid userid de l'adherent
|
||||
* \return > 0 si ok, < 0 si ko
|
||||
*/
|
||||
function create($userid)
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* \brief Fonction qui permet de creer le status de l'adherent
|
||||
* \param userid userid de l'adherent
|
||||
* \return > 0 si ok, < 0 si ko
|
||||
*/
|
||||
function create($userid)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->statut=trim($this->statut);
|
||||
$this->statut=trim($this->statut);
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
||||
$sql.= "libelle";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".addslashes($this->libelle)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
||||
$sql.= "libelle";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".addslashes($this->libelle)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Adherent_type::create sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
|
||||
return $this->update();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
dol_syslog("Adherent_type::create sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent_type");
|
||||
return $this->update();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Met a jour en base donnees du type
|
||||
* \return > 0 si ok, < 0 si ko
|
||||
*/
|
||||
function update()
|
||||
{
|
||||
$this->libelle=trim($this->libelle);
|
||||
/**
|
||||
* \brief Met a jour en base donnees du type
|
||||
* \return > 0 si ok, < 0 si ko
|
||||
*/
|
||||
function update()
|
||||
{
|
||||
$this->libelle=trim($this->libelle);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
||||
$sql.= "SET ";
|
||||
$sql.= "statut = ".$this->statut.",";
|
||||
$sql.= "libelle = '".addslashes($this->libelle) ."',";
|
||||
$sql.= "cotisation = '".$this->cotisation."',";
|
||||
$sql.= "note = '".addslashes($this->note)."',";
|
||||
$sql.= "vote = '".$this->vote."',";
|
||||
$sql.= "mail_valid = '".addslashes($this->mail_valid)."'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
|
||||
$sql.= "SET ";
|
||||
$sql.= "statut = ".$this->statut.",";
|
||||
$sql.= "libelle = '".addslashes($this->libelle) ."',";
|
||||
$sql.= "cotisation = '".$this->cotisation."',";
|
||||
$sql.= "note = '".addslashes($this->note)."',";
|
||||
$sql.= "vote = '".$this->vote."',";
|
||||
$sql.= "mail_valid = '".addslashes($this->mail_valid)."'";
|
||||
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
$sql .= " WHERE rowid = $this->id";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction qui permet de supprimer le status de l'adherent
|
||||
* \param rowid
|
||||
*/
|
||||
function delete($rowid)
|
||||
{
|
||||
/**
|
||||
* \brief Fonction qui permet de supprimer le status de l'adherent
|
||||
* \param rowid
|
||||
*/
|
||||
function delete($rowid)
|
||||
{
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type WHERE rowid = $rowid";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ( $this->db->affected_rows($resql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Err : ".$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ( $this->db->affected_rows($resql) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Err : ".$this->db->error();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fonction qui permet de recuperer le status de l'adherent
|
||||
* \param rowid
|
||||
* \return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".$rowid;
|
||||
/**
|
||||
* \brief Fonction qui permet de recuperer le status de l'adherent
|
||||
* \param rowid
|
||||
* \return int <0 si KO, >0 si OK
|
||||
*/
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".$rowid;
|
||||
|
||||
dol_syslog("Adherent_type::fetch sql=".$sql);
|
||||
dol_syslog("Adherent_type::fetch sql=".$sql);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->statut = $obj->statut;
|
||||
$this->cotisation = $obj->cotisation;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
$this->note = $obj->note;
|
||||
$this->vote = $obj->vote;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Adherent_type::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->statut = $obj->statut;
|
||||
$this->cotisation = $obj->cotisation;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
$this->note = $obj->note;
|
||||
$this->vote = $obj->vote;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Adherent_type::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return list of members' type
|
||||
* \return array List of types
|
||||
*/
|
||||
function liste_array()
|
||||
{
|
||||
global $conf;
|
||||
/**
|
||||
* \brief Return list of members' type
|
||||
* \return array List of types
|
||||
*/
|
||||
function liste_array()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$projets = array();
|
||||
$projets = array();
|
||||
|
||||
$sql = "SELECT rowid, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql = "SELECT rowid, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($nump)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $nump)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$projets[$obj->rowid] = $obj->libelle;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $projets;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
$projets[$obj->rowid] = $obj->libelle;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $projets;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->db->error();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* \param maxlen Longueur max libelle
|
||||
* \param option Page lien
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
{
|
||||
global $langs;
|
||||
/**
|
||||
* \brief Renvoie nom clicable (avec eventuellement le picto)
|
||||
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||
* \param maxlen Longueur max libelle
|
||||
* \param option Page lien
|
||||
* \return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$result='';
|
||||
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'">';
|
||||
$lienfin='</a>';
|
||||
|
||||
$picto='group';
|
||||
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
||||
$picto='group';
|
||||
$label=$langs->trans("ShowTypeCard",$this->libelle);
|
||||
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$lien.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$lienfin;
|
||||
return $result;
|
||||
}
|
||||
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
$result.=$lien.($maxlen?dol_trunc($this->libelle,$maxlen):$this->libelle).$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getMailOnValid
|
||||
* @return Return mail model
|
||||
*/
|
||||
function getMailOnValid()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($this->mail_valid))
|
||||
{
|
||||
return $this->mail_valid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $conf->global->ADHERENT_MAIL_VALID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getMailOnSubscription
|
||||
* @return Return mail model
|
||||
*/
|
||||
function getMailOnSubscription()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($this->mail_subscription)) // Not yet developped
|
||||
{
|
||||
return $this->mail_subscription;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $conf->global->ADHERENT_MAIL_COTIS;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getMailOnResiliate
|
||||
* @return Return mail model
|
||||
*/
|
||||
function getMailOnResiliate()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! empty($this->mail_resiliate)) // Not yet developped
|
||||
{
|
||||
return $this->mail_resiliate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $conf->global->ADHERENT_MAIL_RESIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -541,17 +541,10 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'confirm_valid' && $_P
|
|||
|
||||
if ($result >= 0 && ! sizeof($adh->errors))
|
||||
{
|
||||
// Envoi mail validation (selon param du type adherent sinon generique)
|
||||
// Send confirmation Email (selon param du type adherent sinon generique)
|
||||
if ($adh->email && $_POST["send_mail"])
|
||||
{
|
||||
if (isset($adht->mail_valid) && $adht->mail_valid)
|
||||
{
|
||||
$result=$adh->send_an_email($adht->mail_valid,$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_VALID,$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||
}
|
||||
$result=$adh->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
|
||||
if ($result < 0)
|
||||
{
|
||||
$errmsg.=$adh->error;
|
||||
|
|
@ -595,7 +588,7 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_resign' &
|
|||
{
|
||||
if ($adh->email && $_POST["send_mail"])
|
||||
{
|
||||
$result=$adh->send_an_email($conf->global->ADHERENT_MAIL_RESIL,$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1);
|
||||
$result=$adh->send_an_email($adht->getMailOnResiliate(),$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1);
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
|
|
@ -665,6 +658,180 @@ $adho->fetch_name_optionals_label();
|
|||
|
||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Fiche creation */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
$adh->fk_departement = $_POST["departement_id"];
|
||||
|
||||
// We set pays_id, pays_code and label for the selected country
|
||||
$adh->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
if ($adh->pays_id)
|
||||
{
|
||||
$sql = "SELECT rowid, code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid = ".$adh->pays_id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$adh->pays_id=$obj->rowid;
|
||||
$adh->pays_code=$obj->code;
|
||||
$adh->pays=$obj->libelle;
|
||||
}
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
|
||||
print_fiche_titre($langs->trans("NewMember"));
|
||||
|
||||
if ($errmsg)
|
||||
{
|
||||
print '<div class="error">'.$errmsg.'</div>';
|
||||
}
|
||||
if ($mesg) print '<div class="ok">'.$mesg.'</div>';
|
||||
|
||||
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Moral-Physique
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Person")."</span></td><td>\n";
|
||||
print $html->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$adh->morphy, 1);
|
||||
print "</td>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(isset($_POST["societe"])?$_POST["societe"]:$adh->societe).'"></td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
print $htmlcompany->select_civilite(isset($_POST["civilite_id"])?$_POST["civilite_id"]:$adh->civilite_id,'civilite_id').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Nom
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Lastname").'</span></td><td><input type="text" name="nom" value="'.(isset($_POST["nom"])?$_POST["nom"]:$adh->nom).'" size="40"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Firstname").'</span></td><td><input type="text" name="prenom" size="40" value="'.(isset($_POST["prenom"])?$_POST["prenom"]:$adh->prenom).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td><td><input type="text" name="member_login" size="40" value="'.(isset($_POST["member_login"])?$_POST["member_login"]:$adh->login).'"></td></tr>';
|
||||
|
||||
// Mot de passe
|
||||
$generated_password='';
|
||||
if ($conf->global->USER_PASSWORD_GENERATED)
|
||||
{
|
||||
$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
|
||||
$nomfichier=$nomclass.".class.php";
|
||||
//print DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomclass;
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomfichier);
|
||||
$genhandler=new $nomclass($db,$conf,$langs,$user);
|
||||
$generated_password=$genhandler->getNewGeneratedPassword();
|
||||
}
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
|
||||
print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberType").'</span></td><td>';
|
||||
$listetype=$adht->liste_array();
|
||||
if (sizeof($listetype))
|
||||
{
|
||||
print $html->selectarray("typeid", $listetype, isset($_POST["typeid"])?$_POST["typeid"]:$typeid, 1);
|
||||
} else {
|
||||
print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.(isset($_POST["adresse"])?$_POST["adresse"]:$adh->adresse).'</textarea></td></tr>';
|
||||
|
||||
// CP / Ville
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.(isset($_POST["cp"])?$_POST["cp"]:$adh->cp).'"> <input type="text" name="ville" size="32" value="'.(isset($_POST["ville"])?$_POST["ville"]:$adh->ville).'"></td></tr>';
|
||||
|
||||
// Country
|
||||
$adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id;
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
$html->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$adh->pays_id,'pays_id',$conf->use_javascript_ajax?' onChange="company_save_refresh_create()"':'');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
if ($adh->pays_id)
|
||||
{
|
||||
$htmlcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$adh->fk_departement,$adh->pays_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Tel pro
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$adh->phone).'"></td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$adh->phone_perso).'"></td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$adh->phone_mobile).'"></td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" size="40" value="'.(isset($_POST["member_email"])?$_POST["member_email"]:$adh->email).'"></td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
|
||||
$html->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'formsoc');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Profil public
|
||||
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
|
||||
print $html->selectyesno("public",$adh->public,1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Attribut optionnels
|
||||
foreach($adho->attribute_label as $key=>$value)
|
||||
{
|
||||
print "<tr><td>".$value.'</td><td><input type="text" name="options_'.$key.'" size="40" value="'.(isset($_POST["options_".$key])?$_POST["options_".$key]:'').'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
/*
|
||||
// Third party Dolibarr
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td class="valeur">';
|
||||
print $html->select_societes($adh->fk_soc,'socid','',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Login Dolibarr
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td class="valeur">';
|
||||
print $html->select_users($adh->user_id,'userid',1);
|
||||
print '</td></tr>';
|
||||
*/
|
||||
print "</table>\n";
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("AddMember").'"></center>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
|
|
@ -871,181 +1038,6 @@ if ($action == 'edit')
|
|||
print '</div>';
|
||||
}
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Fiche creation */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
$adh->fk_departement = $_POST["departement_id"];
|
||||
|
||||
// We set pays_id, pays_code and label for the selected country
|
||||
$adh->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||
if ($adh->pays_id)
|
||||
{
|
||||
$sql = "SELECT rowid, code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||
$sql.= " WHERE rowid = ".$adh->pays_id;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$adh->pays_id=$obj->rowid;
|
||||
$adh->pays_code=$obj->code;
|
||||
$adh->pays=$obj->libelle;
|
||||
}
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
|
||||
print_fiche_titre($langs->trans("NewMember"));
|
||||
|
||||
if ($errmsg)
|
||||
{
|
||||
print '<div class="error">'.$errmsg.'</div>';
|
||||
}
|
||||
if ($mesg) print '<div class="ok">'.$mesg.'</div>';
|
||||
|
||||
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Moral-Physique
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Person")."</span></td><td>\n";
|
||||
print $html->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$adh->morphy, 1);
|
||||
print "</td>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(isset($_POST["societe"])?$_POST["societe"]:$adh->societe).'"></td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
print $htmlcompany->select_civilite(isset($_POST["civilite_id"])?$_POST["civilite_id"]:$adh->civilite_id,'civilite_id').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Nom
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Lastname").'</span></td><td><input type="text" name="nom" value="'.(isset($_POST["nom"])?$_POST["nom"]:$adh->nom).'" size="40"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Firstname").'</span></td><td><input type="text" name="prenom" size="40" value="'.(isset($_POST["prenom"])?$_POST["prenom"]:$adh->prenom).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").'</span></td><td><input type="text" name="member_login" size="40" value="'.(isset($_POST["member_login"])?$_POST["member_login"]:$adh->login).'"></td></tr>';
|
||||
|
||||
// Mot de passe
|
||||
$generated_password='';
|
||||
if ($conf->global->USER_PASSWORD_GENERATED)
|
||||
{
|
||||
$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
|
||||
$nomfichier=$nomclass.".class.php";
|
||||
//print DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomclass;
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomfichier);
|
||||
$genhandler=new $nomclass($db,$conf,$langs,$user);
|
||||
$generated_password=$genhandler->getNewGeneratedPassword();
|
||||
}
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Password").'</span></td><td>';
|
||||
print '<input size="30" maxsize="32" type="text" name="password" value="'.$generated_password.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberType").'</span></td><td>';
|
||||
$listetype=$adht->liste_array();
|
||||
if (sizeof($listetype))
|
||||
{
|
||||
print $html->selectarray("typeid", $listetype, isset($_POST["typeid"])?$_POST["typeid"]:$typeid, 1);
|
||||
} else {
|
||||
print '<font class="error">'.$langs->trans("NoTypeDefinedGoToSetup").'</font>';
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="2">'.(isset($_POST["adresse"])?$_POST["adresse"]:$adh->adresse).'</textarea></td></tr>';
|
||||
|
||||
// CP / Ville
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.(isset($_POST["cp"])?$_POST["cp"]:$adh->cp).'"> <input type="text" name="ville" size="32" value="'.(isset($_POST["ville"])?$_POST["ville"]:$adh->ville).'"></td></tr>';
|
||||
|
||||
// Country
|
||||
$adh->pays_id=$adh->pays_id?$adh->pays_id:$mysoc->pays_id;
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td>';
|
||||
$html->select_pays(isset($_POST["pays_id"])?$_POST["pays_id"]:$adh->pays_id,'pays_id',$conf->use_javascript_ajax?' onChange="company_save_refresh_create()"':'');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
||||
if ($adh->pays_id)
|
||||
{
|
||||
$htmlcompany->select_departement(isset($_POST["departement_id"])?$_POST["departement_id"]:$adh->fk_departement,$adh->pays_code);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $countrynotdefined;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Tel pro
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$adh->phone).'"></td></tr>';
|
||||
|
||||
// Tel perso
|
||||
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$adh->phone_perso).'"></td></tr>';
|
||||
|
||||
// Tel mobile
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$adh->phone_mobile).'"></td></tr>';
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED?'<span class="fieldrequired">':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'</span>':'').'</td><td><input type="text" name="member_email" size="40" value="'.(isset($_POST["member_email"])?$_POST["member_email"]:$adh->email).'"></td></tr>';
|
||||
|
||||
// Date naissance
|
||||
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
|
||||
$html->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'formsoc');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Profil public
|
||||
print "<tr><td>".$langs->trans("Public")."</td><td>\n";
|
||||
print $html->selectyesno("public",$adh->public,1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Attribut optionnels
|
||||
foreach($adho->attribute_label as $key=>$value)
|
||||
{
|
||||
print "<tr><td>".$value.'</td><td><input type="text" name="options_'.$key.'" size="40" value="'.(isset($_POST["options_".$key])?$_POST["options_".$key]:'').'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
/*
|
||||
// Third party Dolibarr
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td class="valeur">';
|
||||
print $html->select_societes($adh->fk_soc,'socid','',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Login Dolibarr
|
||||
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td class="valeur">';
|
||||
print $html->select_users($adh->user_id,'userid',1);
|
||||
print '</td></tr>';
|
||||
*/
|
||||
print "</table>\n";
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" class="button" value="'.$langs->trans("AddMember").'"></center>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
}
|
||||
|
||||
if ($rowid && $action != 'edit')
|
||||
{
|
||||
/* ************************************************************************** */
|
||||
|
|
@ -1118,11 +1110,27 @@ if ($rowid && $action != 'edit')
|
|||
{
|
||||
$langs->load("mails");
|
||||
|
||||
// Cree un tableau formulaire
|
||||
$formquestion=array();
|
||||
$label=$langs->trans("SendAnEMailToMember");
|
||||
$label.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$label.=$langs->trans("MailRecipient").': <b>'.$adh->email.'</b>)';
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
|
||||
$subjecttosend=$adh->makeSubstitution($conf->global->ADHERENT_MAIL_VALID_SUBJECT);
|
||||
$texttosend=$adh->makeSubstitution($adht->getMailOnValid());
|
||||
|
||||
$tmp=$langs->trans("SendAnEMailToMember");
|
||||
$tmp.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp.=$langs->trans("MailRecipient").': <b>'.$adh->email.'</b>)';
|
||||
$helpcontent='';
|
||||
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$adh->email.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent.=$subjecttosend."\n";
|
||||
$helpcontent.="<br>";
|
||||
$helpcontent.='<b>'.$langs->trans("Content").'</b>:<br>';
|
||||
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
||||
$label=$html->textwithpicto($tmp,$helpcontent,1,'help');
|
||||
|
||||
// Cree un tableau formulaire
|
||||
$formquestion=array();
|
||||
if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
|
||||
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion);
|
||||
if ($ret == 'html') print '<br>';
|
||||
|
|
@ -1131,7 +1139,7 @@ if ($rowid && $action != 'edit')
|
|||
// Confirm send card by mail
|
||||
if ($action == 'sendinfo')
|
||||
{
|
||||
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo",'',0,1);
|
||||
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$adh->email),"confirm_sendinfo",'',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
|
@ -1140,13 +1148,28 @@ if ($rowid && $action != 'edit')
|
|||
{
|
||||
$langs->load("mails");
|
||||
|
||||
// Cree un tableau formulaire
|
||||
$formquestion=array();
|
||||
$label=$langs->trans("SendAnEMailToMember").' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$label.=$langs->trans("MailRecipient").': <b>'.$adh->email.'</b>';
|
||||
$label.=')';
|
||||
if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?'true':'false'));
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($adh->typeid);
|
||||
|
||||
$subjecttosend=$adh->makeSubstitution($conf->global->ADHERENT_MAIL_RESIL_SUBJECT);
|
||||
$texttosend=$adh->makeSubstitution($adht->getMailOnResiliate());
|
||||
|
||||
$tmp=$langs->trans("SendAnEMailToMember");
|
||||
$tmp.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
|
||||
$tmp.=$langs->trans("MailRecipient").': <b>'.$adh->email.'</b>)';
|
||||
$helpcontent='';
|
||||
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$adh->email.'<br>'."\n";
|
||||
$helpcontent.='<b>'.$langs->trans("Subject").'</b>:<br>'."\n";
|
||||
$helpcontent.=$subjecttosend."\n";
|
||||
$helpcontent.="<br>";
|
||||
$helpcontent.='<b>'.$langs->trans("Content").'</b>:<br>';
|
||||
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
|
||||
$label=$html->textwithpicto($tmp,$helpcontent,1,'help');
|
||||
|
||||
// Cree un tableau formulaire
|
||||
$formquestion=array();
|
||||
if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?'true':'false'));
|
||||
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,8 +121,8 @@ class Form
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Old version of textwithtooltip. Kept for backward compatibility with modules for 2.6.
|
||||
* \deprecated
|
||||
* Old version of textwithtooltip. Kept for backward compatibility with modules for 2.6.
|
||||
* @deprecated
|
||||
*/
|
||||
function textwithhelp($text,$htmltext,$tooltipon=1)
|
||||
{
|
||||
|
|
@ -130,17 +130,17 @@ class Form
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Show a text and picto with tooltip on text or picto
|
||||
* \param text Texte to show
|
||||
* \param htmltext Contenu html du tooltip, code en Html / UTF8
|
||||
* \param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et force en Ajax
|
||||
* \param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
|
||||
* \param img Code img du picto
|
||||
* \param i Numero of tooltip
|
||||
* \param width Width of tooltip
|
||||
* \param shiftX Shift of tooltip
|
||||
* \return string Code html du tooltip (texte+picto)
|
||||
* \remarks Use function textwithpicto if you can.
|
||||
* Show a text and picto with tooltip on text or picto
|
||||
* @param text Texte to show
|
||||
* @param htmltext Contenu html du tooltip, code en Html / UTF8
|
||||
* @param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2, 4=tooltip sur les 2 et force en Ajax
|
||||
* @param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
|
||||
* @param img Code img du picto (use img_xxx() function to get it)
|
||||
* @param i Numero of tooltip
|
||||
* @param width Width of tooltip
|
||||
* @param shiftX Shift of tooltip
|
||||
* @return string Code html du tooltip (texte+picto)
|
||||
* @see Use function textwithpicto if you can.
|
||||
*/
|
||||
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='',$i=1,$width='200',$shiftX='10')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ AddActionDone=Add action done
|
|||
Close=Close
|
||||
Close2=Close
|
||||
Confirm=Confirm
|
||||
ConfirmSendCardByMail=Do you really want to send this card by mail ?
|
||||
ConfirmSendCardByMail=Do you really want to send content of this card by mail to <b>%s</b> ?
|
||||
Delete=Delete
|
||||
Remove=Remove
|
||||
Resiliate=Resiliate
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ AddActionDone=Ajouter action faite
|
|||
Close=Clôturer
|
||||
Close2=Fermer
|
||||
Confirm=Confirmer
|
||||
ConfirmSendCardByMail=Voulez vous envoyer cette fiche par mail ?
|
||||
ConfirmSendCardByMail=Voulez vous envoyer le contenu de cette fiche par mail à l'adresse <b>%s</b> ?
|
||||
Delete=Supprimer
|
||||
Remove=Enlever
|
||||
Resiliate=Résilier
|
||||
|
|
|
|||
|
|
@ -2853,15 +2853,16 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1)
|
|||
|
||||
|
||||
/**
|
||||
* \brief Replace CRLF in string with a HTML BR tag.
|
||||
* \param string2encode String to encode
|
||||
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
||||
* \param forxml false=Use <br>, true=Use <br />
|
||||
* \return string String encoded
|
||||
* Replace CRLF in string with a HTML BR tag.
|
||||
* @param string2encode String to encode
|
||||
* @param nl2brmode 0=Adding br before \n, 1=Replacing \n by br
|
||||
* @param forxml false=Use <br>, true=Use <br />
|
||||
* @return string String encoded
|
||||
*/
|
||||
function dol_nl2br($stringtoencode,$nl2brmode=0,$forxml=false)
|
||||
{
|
||||
if (! $nl2brmode) return nl2br($stringtoencode,$forxml);
|
||||
// We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8;
|
||||
if (! $nl2brmode) return @nl2br($stringtoencode,$forxml);
|
||||
else
|
||||
{
|
||||
$ret=str_replace("\r","",$stringtoencode);
|
||||
|
|
@ -2887,7 +2888,7 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
|
|||
{
|
||||
if (dol_textishtml($stringtoencode))
|
||||
{
|
||||
$newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$stringtoencode); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
|
||||
$newstring=preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i','<br>',$stringtoencode); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
|
||||
$newstring=preg_replace('/<br>$/i','',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
|
||||
$newstring=strtr($newstring,array('&'=>'__and__','<'=>'__lt__','>'=>'__gt__','"'=>'__dquot__'));
|
||||
$newstring=dol_htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding
|
||||
|
|
@ -2895,7 +2896,6 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
|
|||
// If already HTML, CR should be <br> so we don't change \n
|
||||
}
|
||||
else {
|
||||
// We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8;
|
||||
$newstring=dol_nl2br(dol_htmlentities($stringtoencode,ENT_COMPAT,$pagecodefrom),$nl2brmode);
|
||||
}
|
||||
// Other substitutions that htmlentities does not do
|
||||
|
|
@ -3083,33 +3083,37 @@ function dol_textishtml($msg,$option=0)
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Add substitution required by external modules then make substitutions.
|
||||
* Add substitution required by external modules then make substitutions.
|
||||
* There is two type of substitions:
|
||||
* From substitutionarray (oldval=>newval)
|
||||
* From special constants (__XXX__=>f(objet->xxx))
|
||||
* \param chaine Source string in which we must do substitution
|
||||
* \param substitutionarray Array substitution old value => new value value
|
||||
* \param outputlangs If we want substitution from special constants, we provide a language
|
||||
* \param object If we want substitution from special constants, we provide data in a source object
|
||||
* \return string Output string after subsitutions
|
||||
* - From $substitutionarray (oldval=>newval)
|
||||
* - From special constants (__XXX__=>f(objet->xxx)) by substitutions modules
|
||||
* @param chaine Source string in which we must do substitution
|
||||
* @param substitutionarray Array substitution old value => new value value
|
||||
* @param outputlangs If we want substitution from special constants, we provide a language
|
||||
* @param object If we want substitution from special constants, we provide data in a source object
|
||||
* @return string Output string after subsitutions
|
||||
*/
|
||||
function make_substitutions($chaine,$substitutionarray,$outputlangs,$object='')
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
// Check if there is external substitution to do asked by plugins
|
||||
// We look files into the includes/modules/substitutions directory
|
||||
// By default, there is no such external plugins.
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir=$dirroot."/includes/modules/substitutions";
|
||||
$fonc='numberwords'; // For the moment only one file scan
|
||||
if ($conf->$fonc->enabled && file_exists($dir.'/functions_'.$fonc.'.lib.php'))
|
||||
{
|
||||
dol_syslog("Library functions_".$fonc.".lib.php found into ".$dir);
|
||||
require_once($dir."/functions_".$fonc.".lib.php");
|
||||
numberwords_completesubstitutionarray($substitutionarray,$outputlangs,$object);
|
||||
break;
|
||||
$dir=$dirroot."/includes/modules/substitutions";
|
||||
$listfonc=array('numberwords'); // For the moment only one substitution module to search
|
||||
foreach($listfonc as $fonc)
|
||||
{
|
||||
// Check if there is external substitution to do asked by plugins
|
||||
// We look files into the includes/modules/substitutions directory
|
||||
// By default, there is no such external plugins.
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
// If module enabled and complete
|
||||
if (! empty($conf->$fonc->enabled) && file_exists($dir.'/functions_'.$fonc.'.lib.php'))
|
||||
{
|
||||
dol_syslog("Library functions_".$fonc.".lib.php found into ".$dir);
|
||||
require_once($dir."/functions_".$fonc.".lib.php");
|
||||
numberwords_completesubstitutionarray($substitutionarray,$outputlangs,$object);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3123,12 +3127,10 @@ function make_substitutions($chaine,$substitutionarray,$outputlangs,$object='')
|
|||
|
||||
|
||||
/**
|
||||
* \brief Format output for start and end date
|
||||
* \param date_start Start date
|
||||
* \param date_end End date
|
||||
* \param format Output format
|
||||
* \remarks Updated by Matelli : added format paramter
|
||||
* \remarks See http://matelli.fr/showcases/patchs-dolibarr/update-date-range-format.html for details
|
||||
* Format output for start and end date
|
||||
* @param date_start Start date
|
||||
* @param date_end End date
|
||||
* @param format Output format
|
||||
*/
|
||||
function print_date_range($date_start,$date_end,$format = '',$outputlangs='')
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user