53 public $errors = array();
91 global $conf, $langs, $user, $canvas;
92 global
$form, $formcompany, $objsoc;
94 if ($action ==
'add' || $action ==
'update') {
98 foreach ($this->
object as $key => $value) {
99 $this->tpl[$key] = $value;
102 $this->tpl[
'error'] = $this->error;
103 $this->tpl[
'errors'] = $this->errors;
105 if ($action ==
'create' || $action ==
'edit') {
106 if ($conf->use_javascript_ajax) {
107 $this->tpl[
'ajax_selectcountry'] =
"\n".
'<script type="text/javascript">
108 jQuery(document).ready(function () {
109 jQuery("#selectcountry_id").change(function() {
110 document.formsoc.action.value="'.$action.
'";
111 document.formsoc.canvas.value="'.$canvas.
'";
112 document.formsoc.submit();
118 if (is_object($objsoc) && $objsoc->id > 0) {
119 $this->tpl[
'company'] = $objsoc->getNomUrl(1);
120 $this->tpl[
'company_id'] = $objsoc->id;
122 $this->tpl[
'company'] =
$form->select_company($this->object->socid,
'socid',
'', 1);
126 $this->tpl[
'select_civility'] = $formcompany->select_civility($this->object->civility_id);
129 if ((isset($objsoc->typent_code) && $objsoc->typent_code ==
'TE_PRIVATE')) {
130 if (
dol_strlen(trim($this->object->address)) == 0) {
131 $this->tpl[
'address'] = $objsoc->address;
133 if (
dol_strlen(trim($this->object->zip)) == 0) {
134 $this->
object->zip = $objsoc->zip;
136 if (
dol_strlen(trim($this->object->town)) == 0) {
137 $this->
object->town = $objsoc->town;
139 if (
dol_strlen(trim($this->object->phone_perso)) == 0) {
140 $this->
object->phone_perso = $objsoc->phone;
142 if (
dol_strlen(trim($this->object->phone_mobile)) == 0) {
143 $this->
object->phone_mobile = $objsoc->phone_mobile;
145 if (
dol_strlen(trim($this->object->email)) == 0) {
146 $this->
object->email = $objsoc->email;
151 $this->tpl[
'select_zip'] = $formcompany->select_ziptown($this->object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
154 $this->tpl[
'select_town'] = $formcompany->select_ziptown($this->object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
156 if (
dol_strlen(trim($this->object->country_id)) == 0) {
157 $this->
object->country_id = $objsoc->country_id;
161 $this->tpl[
'select_country'] =
$form->select_country($this->object->country_id,
'country_id');
162 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
165 $this->tpl[
'info_admin'] =
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
169 if ($this->object->country_id) {
170 $this->tpl[
'select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
172 $this->tpl[
'select_state'] = $countrynotdefined;
176 $selectarray = array(
'0'=>$langs->trans(
"Physical"),
'1'=>$langs->trans(
"Moral"));
177 $this->tpl[
'select_morphy'] =
$form->selectarray(
'morphy', $selectarray, $this->object->morphy, 0);
180 if ($action ==
'view' || $action ==
'edit' || $action ==
'delete') {
183 $langs->load(
"mails");
184 $this->tpl[
'nb_emailing'] = $this->
object->getNbOfEMailings();
188 if ($this->object->user_id) {
189 $dolibarr_user =
new User($this->
db);
190 $result = $dolibarr_user->fetch($this->object->user_id);
191 $this->tpl[
'dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
193 $this->tpl[
'dolibarr_user'] = $langs->trans(
"NoDolibarrAccess");
197 if ($action ==
'view' || $action ==
'delete') {
198 $this->tpl[
'showrefnav'] =
$form->showrefnav($this->
object,
'id');
200 if ($this->object->socid > 0) {
203 $objsoc->fetch($this->object->socid);
204 $this->tpl[
'company'] = $objsoc->getNomUrl(1);
206 $this->tpl[
'company'] = $langs->trans(
"AdherentNotLinkedToThirdParty");
209 $this->tpl[
'civility'] = $this->
object->getCivilityLabel();
211 $this->tpl[
'address'] =
dol_nl2br($this->object->address);
213 $this->tpl[
'zip'] = ($this->
object->zip ? $this->
object->zip.
' ' :
'');
216 $this->tpl[
'country'] = ($img ? $img.
' ' :
'').$this->object->country;
218 $this->tpl[
'phone_perso'] =
dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id,
'AC_TEL');
219 $this->tpl[
'phone_mobile'] =
dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id,
'AC_TEL');
220 $this->tpl[
'email'] =
dol_print_email($this->object->email, 0, $this->object->id,
'AC_EMAIL');
222 $this->tpl[
'visibility'] = $this->
object->getmorphylib($this->object->morphy);
224 $this->tpl[
'note'] = nl2br($this->object->note);
227 if ($action ==
'create_user') {
229 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
230 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
231 $login =
dol_buildlogin($this->object->lastname, $this->object->firstname);
234 $password = $generated_password;
237 $formquestion = array(
238 array(
'label' => $langs->trans(
"LoginToCreate"),
'type' =>
'text',
'name' =>
'login',
'value' => $login),
239 array(
'label' => $langs->trans(
"Password"),
'type' =>
'text',
'name' =>
'password',
'value' => $password));
241 $this->tpl[
'action_create_user'] =
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$this->object->id, $langs->trans(
"CreateDolibarrLogin"), $langs->trans(
"ConfirmCreateAdherent"),
"confirm_create_user", $formquestion,
'no');
254 global $langs, $mysoc;
256 $this->
object->old_name =
GETPOST(
"old_name");
257 $this->
object->old_firstname =
GETPOST(
"old_firstname");
259 $this->
object->fk_soc =
GETPOST(
"fk_soc");
260 $this->
object->lastname =
GETPOST(
"lastname");
261 $this->
object->firstname =
GETPOST(
"firstname");
262 $this->
object->civility_id =
GETPOST(
"civility_id");
263 $this->
object->address =
GETPOST(
"address");
264 $this->
object->zip =
GETPOST(
"zipcode");
265 $this->
object->town =
GETPOST(
"town");
266 $this->
object->country_id =
GETPOST(
"country_id",
'int') ?
GETPOST(
"country_id",
'int') : $mysoc->country_id;
267 $this->
object->state_id =
GETPOST(
"state_id",
'int');
268 $this->
object->phone_perso =
GETPOST(
"phone_perso");
269 $this->
object->phone_mobile =
GETPOST(
"phone_mobile");
270 $this->
object->email =
GETPOST(
"email",
'alphawithlgt');
271 $this->
object->note =
GETPOST(
"note",
'restricthtml');
272 $this->
object->canvas =
GETPOST(
"canvas");
275 if ($this->object->country_id) {
276 $sql =
"SELECT code, label FROM ".MAIN_DB_PREFIX.
"c_country WHERE rowid = ".((int) $this->object->country_id);
279 $obj = $this->
db->fetch_object(
$resql);
281 $this->
object->country_code = $obj->code;
282 $this->
object->country = $langs->trans(
"Country".$obj->code) ? $langs->trans(
"Country".$obj->code) : $obj->libelle;
Class to manage members using default canvas.
assign_post()
Assign POST values into object.
assign_values(&$action, $id)
Set content of ->tpl array, to use into template.
getObject($id)
Get object.
Class to manage members of a foundation.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_buildlogin($lastname, $firstname)
Build a login from lastname, firstname.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
dol_print_phone($phone, $countrycode='', $cid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0)
Format phone numbers according to country.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
isModEnabled($module)
Is Dolibarr module enabled.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
$conf db
API class for accounts.