Merge pull request #7597 from hregis/develop_member

NEW add company alias name when create company from member
This commit is contained in:
Laurent Destailleur 2017-10-11 11:31:55 +02:00 committed by GitHub
commit e644f7df58
11 changed files with 171 additions and 143 deletions

View File

@ -240,9 +240,9 @@ $constantes=array(
print load_fiche_titre($langs->trans("MembersCards"),'','');
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
$helptext.='%YEAR%, %MONTH%, %DAY%';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
@ -257,9 +257,9 @@ $constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT');
print load_fiche_titre($langs->trans("MembersTickets"),'','');
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
$helptext.='%YEAR%, %MONTH%, %DAY%';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);

View File

@ -171,14 +171,14 @@ $constantes=array(
);
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
$helptext.='%YEAR%, %MONTH%, %DAY%';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__';
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
form_constantes($constantes, 0, $helptext);

View File

@ -121,7 +121,7 @@ $hookmanager->initHooks(array('membercard','globalcard'));
* Actions
*/
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas);
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -223,7 +223,7 @@ if (empty($reshook))
{
// User creation
$company = new Societe($db);
$result=$company->create_from_member($object,GETPOST('companyname'));
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
if ($result < 0)
{
@ -843,7 +843,7 @@ else
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="maxwidth200" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(isset($_POST["member_login"])?GETPOST("member_login", 'alpha', 2):$object->login).'"></td></tr>';
}
// Password
@ -852,7 +852,7 @@ else
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generated_password=getRandomPassword(false);
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 '<input type="text" class="minwidth300" maxlength="50" name="password" value="'.$generated_password.'">';
print '</td></tr>';
}
@ -875,7 +875,7 @@ else
print "</td>\n";
// Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -883,15 +883,15 @@ else
print '</tr>';
// Lastname
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.(GETPOST('lastname','alpha')?GETPOST('lastname','alpha'):$object->lastname).'" size="40"></td>';
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(GETPOST('lastname','alpha')?GETPOST('lastname','alpha'):$object->lastname).'"></td>';
print '</tr>';
// Firstname
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(GETPOST('firstname','alpha')?GETPOST('firstname','alpha'):$object->firstname).'"></td>';
print '</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="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
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" class="minwidth300" maxlength="255" value="'.(GETPOST('member_email','alpha')?GETPOST('member_email','alpha'):$object->email).'"></td></tr>';
// Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
@ -1081,13 +1081,13 @@ else
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="maxwidth200" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
}
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="maxwdith200" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
}
// Morphy
$morphys["phy"] = $langs->trans("Physical");
@ -1110,7 +1110,7 @@ else
print "</td></tr>";
// Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth100" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth300" maxlength="128" value="'.(isset($_POST["societe"])?GETPOST("societe",'',2):$object->societe).'"></td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
@ -1119,11 +1119,11 @@ else
print '</tr>';
// Lastname
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth100" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
print '<tr><td id="tdlastname">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth300" maxlength="50" value="'.(isset($_POST["lastname"])?GETPOST("lastname",'',2):$object->lastname).'"></td>';
print '</tr>';
// Firstname
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth100" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
print '<tr><td id="tdfirstname">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth300" maxlength="50" value="'.(isset($_POST["firstname"])?GETPOST("firstname",'',3):$object->firstname).'"></td>';
print '</tr>';
// Photo
@ -1142,7 +1142,7 @@ else
print '</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"])?GETPOST("member_email",'',2):$object->email).'"></td></tr>';
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" class="minwidth300" maxlength="255" value="'.(isset($_POST["member_email"])?GETPOST("member_email",'',2):$object->email).'"></td></tr>';
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td>';
@ -1319,18 +1319,25 @@ else
// Confirm create third party
if ($action == 'create_thirdparty')
{
$name = $object->getFullName($langs);
if (! empty($name))
$companyalias='';
$fullname = $object->getFullName($langs);
if ($object->morphy == 'mor')
{
if ($object->societe) $name.=' ('.$object->societe.')';
$companyname=$object->societe;
if (! empty($fullname)) $companyalias=$fullname;
}
else
{
$name=$object->societe;
$companyname=$fullname;
if (! empty($object->societe)) $companyalias=$object->societe;
}
// Create a form array
$formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
$formquestion=array(
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
}
@ -1347,8 +1354,8 @@ else
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
$tmp=$langs->trans("SendAnEMailToMember");
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$tmp.='<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.='<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
$helpcontent='';
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
$helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";

View File

@ -116,25 +116,25 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// List of values to scan for a replacement
$substitutionarray = array (
'%ID%'=>$objp->rowid,
'%LOGIN%'=>$objp->login,
'%FIRSTNAME%'=>$objp->firstname,
'%LASTNAME%'=>$objp->lastname,
'%FULLNAME%'=>$adherentstatic->getFullName($langs),
'%COMPANY%'=>$objp->company,
'%ADDRESS%'=>$objp->address,
'%ZIP%'=>$objp->zip,
'%TOWN%'=>$objp->town,
'%COUNTRY%'=>$objp->country,
'%COUNTRY_CODE%'=>$objp->country_code,
'%EMAIL%'=>$objp->email,
'%BIRTH%'=>dol_print_date($objp->birth,'day'),
'%TYPE%'=>$objp->type,
'%YEAR%'=>$year,
'%MONTH%'=>$month,
'%DAY%'=>$day,
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
'__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
'__LASTNAME__'=>$objp->lastname,
'__FULLNAME__'=>$adherentstatic->getFullName($langs),
'__COMPANY__'=>$objp->company,
'__ADDRESS__'=>$objp->address,
'__ZIP__'=>$objp->zip,
'__TOWN__'=>$objp->town,
'__COUNTRY__'=>$objp->country,
'__COUNTRY_CODE__'=>$objp->country_code,
'__EMAIL__'=>$objp->email,
'__BIRTH__'=>dol_print_date($objp->birth,'day'),
'__TYPE__'=>$objp->type,
'__YEAR__'=>$year,
'__MONTH__'=>$month,
'__DAY__'=>$day,
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
@ -179,7 +179,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// For labels
if ($mode == 'label')
{
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%";
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
$textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
$textheader='';
$textfooter='';

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -109,7 +109,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
{
// Creation user
$company = new Societe($db);
$result=$company->create_from_member($object,$_POST["companyname"]);
$result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'));
if ($result < 0)
{
@ -960,19 +960,25 @@ if ($rowid > 0)
// Confirm create third party
if ($action == 'create_thirdparty')
{
$name = $object->getFullName($langs);
if (! empty($name))
$companyalias='';
$fullname = $object->getFullName($langs);
if ($object->morphy == 'mor')
{
if ($object->morphy == 'mor' && ! empty($object->societe)) $name=$object->societe.' ('.$name.')';
else if ($object->societe) $name.=' ('.$object->societe.')';
$companyname=$object->societe;
if (! empty($fullname)) $companyalias=$fullname;
}
else
{
$name=$object->societe;
$companyname=$fullname;
if (! empty($object->societe)) $companyalias=$object->societe;
}
// Create a form array
$formquestion=array(array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name));
$formquestion=array(
array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
}

View File

@ -3578,27 +3578,29 @@ class Form
if (is_array($input) && ! empty($input))
{
$size=(! empty($input['size'])?' size="'.$input['size'].'"':'');
$moreattr=(! empty($input['moreattr'])?' '.$input['moreattr']:'');
$morecss=(! empty($input['morecss'])?' '.$input['morecss']:'');
if ($input['type'] == 'text')
{
$more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
$more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="text" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
}
else if ($input['type'] == 'password')
{
$more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
$more.='<tr><td>'.$input['label'].'</td><td colspan="2" align="left"><input type="password" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></td></tr>'."\n";
}
else if ($input['type'] == 'select')
{
$more.='<tr><td>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td valign="top" colspan="2" align="left">';
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1);
$more.=$this->selectarray($input['name'],$input['values'],$input['default'],1,0,0,$moreattr,0,0,0,'',$morecss);
$more.='</td></tr>'."\n";
}
else if ($input['type'] == 'checkbox')
{
$more.='<tr>';
$more.='<td>'.$input['label'].' </td><td align="left">';
$more.='<input type="checkbox" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"';
$more.='<input type="checkbox" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'"'.$moreattr;
if (! is_bool($input['value']) && $input['value'] != 'false') $more.=' checked';
if (is_bool($input['value']) && $input['value']) $more.=' checked';
if (isset($input['disabled'])) $more.=' disabled';
@ -3614,7 +3616,7 @@ class Form
$more.='<tr>';
if ($i==0) $more.='<td class="tdtop">'.$input['label'].'</td>';
else $more.='<td>&nbsp;</td>';
$more.='<td width="20"><input type="radio" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"';
$more.='<td width="20"><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr;
if ($input['disabled']) $more.=' disabled';
$more.=' /></td>';
$more.='<td align="left">';
@ -6021,7 +6023,16 @@ class Form
{
$ret.=dol_htmlentities($object->name);
}
else if (in_array($object->element, array('contact', 'user', 'usergroup', 'member')))
else if ($object->element == 'member')
{
$fullname=$object->getFullName($langs);
if ($object->morphy == 'mor') {
$ret.= dol_htmlentities($object->societe) . ((! empty($fullname) && $object->societe != $fullname)?' ('.dol_htmlentities($fullname).')':'');
} else {
$ret.= dol_htmlentities($fullname) . ((! empty($object->societe) && $object->societe != $fullname)?' ('.dol_htmlentities($object->societe).')':'');
}
}
else if (in_array($object->element, array('contact', 'user', 'usergroup')))
{
$ret.=dol_htmlentities($object->getFullName($langs));
}

View File

@ -48,8 +48,8 @@ class pdf_standard extends CommonStickerGenerator
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
* - %LOGO% is replace with company logo
* - %PHOTO% is replace with photo provided as parameter
* - __LOGO__ is replace with company logo
* - __PHOTO__ is replace with photo provided as parameter
*
* @param PDF $pdf PDF
* @param string $textleft Text left
@ -58,7 +58,7 @@ class pdf_standard extends CommonStickerGenerator
* @param Translate $outputlangs Output langs
* @param string $textright Text right
* @param int $idmember Id member
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
* @param string $photo Photo (full path to image file used as replacement for key __PHOTOS__ into left, right, header or footer text)
* @return void
*/
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='')
@ -95,7 +95,7 @@ class pdf_standard extends CommonStickerGenerator
$member=new Adherent($db);
$member->id = $idmember;
$member->ref = $idmember;
// Define photo
$dir=$conf->adherent->dir_output;
if (! empty($photo))
@ -161,8 +161,8 @@ class pdf_standard extends CommonStickerGenerator
if ($textright=='') // Only a left part
{
// Output left area
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
if ($textleft == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textleft == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else
{
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
@ -171,17 +171,17 @@ class pdf_standard extends CommonStickerGenerator
}
else if ($textleft!='' && $textright!='') //
{
if ($textleft == '%LOGO%' || $textleft == '%PHOTO%')
if ($textleft == '__LOGO__' || $textleft == '__PHOTO__')
{
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
if ($textleft == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textleft == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
$pdf->SetXY($_PosX+$xleft+$widthtouse+1, $_PosY+$ytop);
$pdf->MultiCell($this->_Width-$xleft-$xleft-$widthtouse-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
}
else if ($textright == '%LOGO%' || $textright == '%PHOTO%')
else if ($textright == '__LOGO__' || $textright == '__PHOTO__')
{
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
if ($textright == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textright == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
$pdf->MultiCell($this->_Width-$widthtouse-$xleft-$xleft-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L');
}
@ -196,8 +196,8 @@ class pdf_standard extends CommonStickerGenerator
else // Only a right part
{
// Output right area
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
if ($textright == '__LOGO__' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else if ($textright == '__PHOTO__' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse);
else
{
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
@ -247,34 +247,34 @@ class pdf_standard extends CommonStickerGenerator
function write_file($object, $outputlangs, $srctemplatepath, $mode='member', $nooutput=0)
{
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
$this->code=$srctemplatepath;
if (is_object($object))
{
if ($object->country == '-') $object->country='';
// List of values to scan for a replacement
$substitutionarray = array (
'%ID%'=>$object->rowid,
'%LOGIN%'=>$object->login,
'%FIRSTNAME%'=>$object->firstname,
'%LASTNAME%'=>$object->lastname,
'%FULLNAME%'=>$object->getFullName($langs),
'%COMPANY%'=>$object->company,
'%ADDRESS%'=>$object->address,
'%ZIP%'=>$object->zip,
'%TOWN%'=>$object->town,
'%COUNTRY%'=>$object->country,
'%COUNTRY_CODE%'=>$object->country_code,
'%EMAIL%'=>$object->email,
'%BIRTH%'=>dol_print_date($object->birth,'day'),
'%TYPE%'=>$object->type,
'%YEAR%'=>$year,
'%MONTH%'=>$month,
'%DAY%'=>$day,
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
'__ID__'=>$object->rowid,
'__LOGIN__'=>$object->login,
'__FIRSTNAME__'=>$object->firstname,
'__LASTNAME__'=>$object->lastname,
'__FULLNAME__'=>$object->getFullName($langs),
'__COMPANY__'=>$object->company,
'__ADDRESS__'=>$object->address,
'__ZIP__'=>$object->zip,
'__TOWN__'=>$object->town,
'__COUNTRY__'=>$object->country,
'__COUNTRY_CODE__'=>$object->country_code,
'__EMAIL__'=>$object->email,
'__BIRTH__'=>dol_print_date($object->birth,'day'),
'__TYPE__'=>$object->type,
'__YEAR__'=>$year,
'__MONTH__'=>$month,
'__DAY__'=>$day,
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__SERVER__'=>"http://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs);
@ -283,10 +283,10 @@ class pdf_standard extends CommonStickerGenerator
$textheader=make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
$nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY'];
if ($nb <= 0) $nb=1; // Protection to avoid empty page
for($j=0;$j<$nb;$j++)
{
$arrayofmembers[]=array(
@ -298,7 +298,7 @@ class pdf_standard extends CommonStickerGenerator
'photo'=>$object->photo
);
}
$arrayofrecords = $arrayofmembers;
}
else
@ -348,7 +348,7 @@ class pdf_standard extends CommonStickerGenerator
$dir = $outputdir."/".get_exdir(0, 0, 0, 0, $object, 'member');
$file = $dir.'/'.$filename;
}
else
else
{
$outputdir = $conf->adherent->dir_temp;
$dir = $outputdir;
@ -419,28 +419,28 @@ class pdf_standard extends CommonStickerGenerator
$this->result = array('fullpath'=>$file);
// Output to http stream
if (empty($nooutput))
{
clearstatcache();
$attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$type=dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
}
return 1;
}

View File

@ -93,7 +93,7 @@ class modAdherent extends DolibarrModules
$this->const[$r][0] = "ADHERENT_MAIL_VALID";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n";
$this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n__INFOS__\r\n\r\n";
$this->const[$r][3] = "Mail de validation";
$this->const[$r][4] = 0;
$r++;
@ -121,7 +121,7 @@ class modAdherent extends DolibarrModules
$this->const[$r][0] = "ADHERENT_MAIL_COTIS";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "Bonjour %FIRSTNAME%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée";
$this->const[$r][2] = "Bonjour __FIRSTNAME__,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée";
$this->const[$r][3] = "Mail de validation de cotisation";
$this->const[$r][4] = 0;
$r++;
@ -135,21 +135,21 @@ class modAdherent extends DolibarrModules
$this->const[$r][0] = "ADHERENT_CARD_HEADER_TEXT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "%YEAR%";
$this->const[$r][2] = "__YEAR__";
$this->const[$r][3] = "Texte imprimé sur le haut de la carte adhérent";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_CARD_FOOTER_TEXT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "%COMPANY%";
$this->const[$r][2] = "__COMPANY__";
$this->const[$r][3] = "Texte imprimé sur le bas de la carte adhérent";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_CARD_TEXT";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "%FULLNAME%\r\nID: %ID%\r\n%EMAIL%\r\n%ADDRESS%\r\n%ZIP% %TOWN%\r\n%COUNTRY%";
$this->const[$r][2] = "__FULLNAME__\r\nID: __ID__\r\n__EMAIL__\r\n__ADDRESS__\r\n__ZIP__ __TOWN__\r\n__COUNTRY__";
$this->const[$r][3] = "Text to print on member cards";
$this->const[$r][4] = 0;
$r++;
@ -184,7 +184,7 @@ class modAdherent extends DolibarrModules
$this->const[$r][0] = "ADHERENT_ETIQUETTE_TEXT";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%";
$this->const[$r][2] = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY%";
$this->const[$r][3] = "Text to print on member address sheets";
$this->const[$r][4] = 0;
$r++;
@ -324,7 +324,7 @@ class modAdherent extends DolibarrModules
// End add extra fields
$this->import_fieldshidden_array[$r]=array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'adherent'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m__%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* 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
@ -63,7 +63,7 @@ class InterfaceLogevents extends DolibarrTriggers
if ($action == 'USER_LOGIN')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$text="(UserLogged,".$object->login.")";
@ -177,7 +177,7 @@ class InterfaceLogevents extends DolibarrTriggers
// Add more information into desc from the context property
if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit'];
// Add entry in event table
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
*
* 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
@ -635,8 +635,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("members");
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
@ -648,8 +648,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("members");
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->ref);
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
@ -661,8 +661,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("members");
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref);
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
$object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
@ -676,8 +676,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("members");
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref);
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
@ -689,8 +689,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("members");
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref);
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs));
$object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr",$object->getFullName($langs));
$object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
$object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;

View File

@ -2981,19 +2981,23 @@ class Societe extends CommonObject
* Create a third party into database from a member object
*
* @param Adherent $member Object member
* @param string $socname Name of third party to force
* @param string $socname Name of third party to force
* @param string $socalias Alias name of third party to force
* @return int <0 if KO, id of created account if OK
*/
function create_from_member(Adherent $member,$socname='')
function create_from_member(Adherent $member, $socname='', $socalias='')
{
global $user,$langs;
$name = $socname?$socname:$member->societe;
if (empty($name)) $name=$member->getFullName($langs);
$alias = $socalias?$socalias:'';
// Positionne parametres
$this->nom=$name; // TODO deprecated
$this->name=$name;
$this->name_alias=$alias;
$this->address=$member->address;
$this->zip=$member->zip;
$this->town=$member->town;