diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 93b90c01c92..ada5dd82060 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -240,9 +240,9 @@ $constantes=array( print load_fiche_titre($langs->trans("MembersCards"),'',''); $helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -$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").'
'; -$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); diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index a4c2f937146..ac4d88b1bba 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -171,14 +171,14 @@ $constantes=array( ); $helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -$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").'
'; -$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); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5ab8ff1cc99..95cfd729fe5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -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 ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; } // Password @@ -852,7 +852,7 @@ else require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password=getRandomPassword(false); print ''.$langs->trans("Password").''; - print ''; + print ''; print ''; } @@ -875,7 +875,7 @@ else print "\n"; // Company - print ''.$langs->trans("Company").''; + print ''.$langs->trans("Company").''; // Civility print ''.$langs->trans("UserTitle").''; @@ -883,15 +883,15 @@ else print ''; // Lastname - print ''.$langs->trans("Lastname").''; + print ''.$langs->trans("Lastname").''; print ''; // Firstname - print ''.$langs->trans("Firstname").''; + print ''.$langs->trans("Firstname").''; print ''; // EMail - print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').''; + print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').''; // Address print ''.$langs->trans("Address").''; @@ -1081,13 +1081,13 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; } // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").'pass).'">'; + print ''.$langs->trans("Password").'pass).'">'; } // Morphy $morphys["phy"] = $langs->trans("Physical"); @@ -1110,7 +1110,7 @@ else print ""; // Company - print ''.$langs->trans("Company").'societe).'">'; + print ''.$langs->trans("Company").'societe).'">'; // Civility print ''.$langs->trans("UserTitle").''; @@ -1119,11 +1119,11 @@ else print ''; // Lastname - print ''.$langs->trans("Lastname").'lastname).'">'; + print ''.$langs->trans("Lastname").'lastname).'">'; print ''; // Firstname - print ''.$langs->trans("Firstname").'firstname).'">'; + print ''.$langs->trans("Firstname").'firstname).'">'; print ''; // Photo @@ -1142,7 +1142,7 @@ else print ''; // EMail - print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; + print ''.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; // Address print ''.$langs->trans("Address").''; @@ -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.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; - $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; + $tmp.='
'.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.='
'.$langs->trans("MailRecipient").': '.$object->email.''; $helpcontent=''; $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 63fd59f01e9..487dfa7f225 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -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=''; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 4b8f3b50648..9fa30981a9f 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -1,8 +1,8 @@ +/* Copyright (C) 2001-2004 Rodolphe Quiedeville * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012-2017 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro * * 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); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6f968db22d3..50833fc857c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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.=''.$input['label'].''."\n"; + $more.=''.$input['label'].''."\n"; } else if ($input['type'] == 'password') { - $more.=''.$input['label'].''."\n"; + $more.=''.$input['label'].''."\n"; } else if ($input['type'] == 'select') { $more.=''; if (! empty($input['label'])) $more.=$input['label'].''; - $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.=''."\n"; } else if ($input['type'] == 'checkbox') { $more.=''; $more.=''.$input['label'].' '; - $more.=''; else $more.=' '; - $more.='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)); } diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 6fd8ecfee70..4d08be83a43 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -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; } diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index ade0e2c7e75..aa098146dc7 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -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')); } diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 466712260c6..c2f15bd336d 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -1,7 +1,7 @@ - * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2009-2017 Regis Houssin + * Copyright (C) 2014 Marcos García * * 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'; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index ec1fa9465b5..3c34d0a3ee0 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1,10 +1,10 @@ - * Copyright (C) 2009-2011 Regis Houssin - * Copyright (C) 2011-2014 Juanjo Menent - * Copyright (C) 2013 Cedric GROSS - * Copyright (C) 2014 Marcos García - * Copyright (C) 2015 Bahfir Abbes +/* Copyright (C) 2005-2017 Laurent Destailleur + * Copyright (C) 2009-2017 Regis Houssin + * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2013 Cedric GROSS + * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Bahfir Abbes * * 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; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1c8c515545a..bf449f30976 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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;