diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 417d4cd2c99..2a8177df6f2 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -43,19 +43,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array("companies","bills","members","users","other")); +$langs->loadLangs(array("companies", "bills", "members", "users", "other")); -$action=GETPOST('action', 'alpha'); -$cancel=GETPOST('cancel', 'alpha'); -$backtopage=GETPOST('backtopage', 'alpha'); -$confirm=GETPOST('confirm', 'alpha'); -$rowid=GETPOST('rowid', 'int'); -$id=GETPOST('id')?GETPOST('id', 'int'):$rowid; -$typeid=GETPOST('typeid', 'int'); -$userid=GETPOST('userid', 'int'); -$socid=GETPOST('socid', 'int'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$rowid = GETPOST('rowid', 'int'); +$id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; +$typeid = GETPOST('typeid', 'int'); +$userid = GETPOST('userid', 'int'); +$socid = GETPOST('socid', 'int'); -if (! empty($conf->mailmanspip->enabled)) +if (!empty($conf->mailmanspip->enabled)) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -74,9 +74,9 @@ $socialnetworks = getArrayOfSocialNetworks(); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id); -$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); -$objcanvas=null; -if (! empty($canvas)) +$canvas = $object->canvas ? $object->canvas : GETPOST("canvas"); +$objcanvas = null; +if (!empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); @@ -84,7 +84,7 @@ if (! empty($canvas)) } // Security check -$result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); +$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); if ($id > 0) { @@ -92,28 +92,28 @@ if ($id > 0) $result = $object->fetch($id); // Define variables to know what current user can do on users - $canadduser=($user->admin || $user->rights->user->user->creer); + $canadduser = ($user->admin || $user->rights->user->user->creer); // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member - $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer) + $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) || (($user->id != $object->user_id) && $user->rights->user->user->creer)); - $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password) + $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) || (($user->id != $object->user_id) && $user->rights->user->user->password)); } } // Define variables to determine what the current user can do on the members -$canaddmember=$user->rights->adherent->creer; +$canaddmember = $user->rights->adherent->creer; // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember=$user->rights->adherent->creer; + $caneditfieldmember = $user->rights->adherent->creer; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('membercard','globalcard')); +$hookmanager->initHooks(array('membercard', 'globalcard')); @@ -121,25 +121,25 @@ $hookmanager->initHooks(array('membercard','globalcard')); * Actions */ -$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 +$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'); if (empty($reshook)) { if ($cancel) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } - $action=''; + $action = ''; } if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { - $error=0; + $error = 0; if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only { if ($userid != $user->id && $userid != $object->user_id) @@ -149,47 +149,47 @@ if (empty($reshook)) } } - if (! $error) + if (!$error) { if ($userid != $object->user_id) // If link differs from currently in database { - $result=$object->setUserId($userid); + $result = $object->setUserId($userid); if ($result < 0) dol_print_error($object->db, $object->error); - $action=''; + $action = ''; } } } if ($action == 'setsocid') { - $error=0; - if (! $error) + $error = 0; + if (!$error) { if ($socid != $object->socid) // If link differs from currently in database { - $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; - $sql.=" WHERE socid = '".$socid."'"; - $sql.=" AND entity = ".$conf->entity; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; + $sql .= " WHERE socid = '".$socid."'"; + $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj && $obj->rowid > 0) { - $othermember=new Adherent($db); + $othermember = new Adherent($db); $othermember->fetch($obj->rowid); - $thirdparty=new Societe($db); + $thirdparty = new Societe($db); $thirdparty->fetch($socid); $error++; setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors'); } } - if (! $error) + if (!$error) { - $result=$object->setThirdPartyId($socid); + $result = $object->setThirdPartyId($socid); if ($result < 0) dol_print_error($object->db, $object->error); - $action=''; + $action = ''; } } } @@ -202,7 +202,7 @@ if (empty($reshook)) { // Creation user $nuser = new User($db); - $result=$nuser->create_from_member($object, GETPOST('login')); + $result = $nuser->create_from_member($object, GETPOST('login')); if ($result < 0) { @@ -223,7 +223,7 @@ if (empty($reshook)) { // User creation $company = new Societe($db); - $result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha')); + $result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha')); if ($result < 0) { @@ -238,29 +238,29 @@ if (empty($reshook)) } } - if ($action == 'update' && ! $cancel && $user->rights->adherent->creer) + if ($action == 'update' && !$cancel && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $birthdate=''; + $birthdate = ''; if (isset($_POST["birthday"]) && $_POST["birthday"] && isset($_POST["birthmonth"]) && $_POST["birthmonth"] && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } - $lastname=$_POST["lastname"]; - $firstname=$_POST["firstname"]; + $lastname = $_POST["lastname"]; + $firstname = $_POST["firstname"]; $gender = $_POST["gender"]; - $societe=$_POST["societe"]; - $morphy=$_POST["morphy"]; - $login=$_POST["login"]; + $societe = $_POST["societe"]; + $morphy = $_POST["morphy"]; + $login = $_POST["login"]; if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors'); } - if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); @@ -279,7 +279,7 @@ if (empty($reshook)) } } // Create new object - if ($result > 0 && ! $error) + if ($result > 0 && !$error) { $object->oldcopy = clone $object; @@ -291,7 +291,7 @@ if (empty($reshook)) $object->login = trim(GETPOST("login", 'alpha')); $object->pass = trim(GETPOST("pass", 'alpha')); - $object->societe = trim(GETPOST("societe", 'alpha')); // deprecated + $object->societe = trim(GETPOST("societe", 'alpha')); // deprecated $object->company = trim(GETPOST("societe", 'alpha')); $object->address = trim(GETPOST("address", 'alpha')); @@ -302,11 +302,11 @@ if (empty($reshook)) $object->phone = trim(GETPOST("phone", 'alpha')); $object->phone_perso = trim(GETPOST("phone_perso", 'alpha')); - $object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha')); + $object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha')); $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $object->socialnetworks = array(); foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml')); } } @@ -320,8 +320,8 @@ if (empty($reshook)) //$object->note = trim(GETPOST("comment","alpha")); $object->morphy = GETPOST("morphy", 'alpha'); - if (GETPOST('deletephoto', 'alpha')) $object->photo=''; - elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); + if (GETPOST('deletephoto', 'alpha')) $object->photo = ''; + elseif (!empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Get status and public property $object->statut = GETPOST("statut", 'alpha'); @@ -332,36 +332,36 @@ if (empty($reshook)) if ($ret < 0) $error++; // Check if we need to also synchronize user information - $nosyncuser=0; + $nosyncuser = 0; if ($object->user_id) // If linked to a user { - if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser=1; // Disable synchronizing + if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser = 1; // Disable synchronizing } // Check if we need to also synchronize password information - $nosyncuserpass=0; + $nosyncuserpass = 0; if ($object->user_id) // If linked to a user { - if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass=1; // Disable synchronizing + if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing } - $result=$object->update($user, 0, $nosyncuser, $nosyncuserpass); + $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); - if ($result >= 0 && ! count($object->errors)) + if ($result >= 0 && !count($object->errors)) { $categories = GETPOST('memcats', 'array'); $object->setCategories($categories); // Logo/Photo save - $dir= $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; + $dir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (GETPOST('deletephoto')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $fileimg=$conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; - $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileimg = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; + $dirthumbs = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } @@ -372,8 +372,8 @@ if (empty($reshook)) if (@is_dir($dir)) { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } @@ -391,7 +391,7 @@ if (empty($reshook)) } else { - switch($_FILES['photo']['error']) + switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form @@ -403,11 +403,11 @@ if (empty($reshook)) } } - $rowid=$object->id; - $id=$object->id; - $action=''; + $rowid = $object->id; + $id = $object->id; + $action = ''; - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -416,67 +416,67 @@ if (empty($reshook)) else { setEventMessages($object->error, $object->errors, 'errors'); - $action=''; + $action = ''; } } else { - $action='edit'; + $action = 'edit'; } } if ($action == 'add' && $user->rights->adherent->creer) { - if ($canvas) $object->canvas=$canvas; - $birthdate=''; + if ($canvas) $object->canvas = $canvas; + $birthdate = ''; if (isset($_POST["birthday"]) && $_POST["birthday"] && isset($_POST["birthmonth"]) && $_POST["birthmonth"] && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } - $datesubscription=''; + $datesubscription = ''; if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) { - $datesubscription=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datesubscription = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } - $typeid=GETPOST("typeid", 'int'); - $civility_id=GETPOST("civility_id", 'alpha'); - $lastname=GETPOST("lastname", 'alpha'); - $firstname=GETPOST("firstname", 'alpha'); - $gender=GETPOST("gender", 'alpha'); - $societe=GETPOST("societe", 'alpha'); - $address=GETPOST("address", 'alpha'); - $zip=GETPOST("zipcode", 'alpha'); - $town=GETPOST("town", 'alpha'); - $state_id=GETPOST("state_id", 'int'); - $country_id=GETPOST("country_id", 'int'); + $typeid = GETPOST("typeid", 'int'); + $civility_id = GETPOST("civility_id", 'alpha'); + $lastname = GETPOST("lastname", 'alpha'); + $firstname = GETPOST("firstname", 'alpha'); + $gender = GETPOST("gender", 'alpha'); + $societe = GETPOST("societe", 'alpha'); + $address = GETPOST("address", 'alpha'); + $zip = GETPOST("zipcode", 'alpha'); + $town = GETPOST("town", 'alpha'); + $state_id = GETPOST("state_id", 'int'); + $country_id = GETPOST("country_id", 'int'); - $phone=GETPOST("phone", 'alpha'); - $phone_perso=GETPOST("phone_perso", 'alpha'); - $phone_mobile=GETPOST("phone_mobile", 'alpha'); + $phone = GETPOST("phone", 'alpha'); + $phone_perso = GETPOST("phone_perso", 'alpha'); + $phone_mobile = GETPOST("phone_mobile", 'alpha'); // $skype=GETPOST("member_skype", 'alpha'); // $twitter=GETPOST("member_twitter", 'alpha'); // $facebook=GETPOST("member_facebook", 'alpha'); // $linkedin=GETPOST("member_linkedin", 'alpha'); - $email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); - $login=GETPOST("member_login", 'alpha'); - $pass=GETPOST("password", 'alpha'); - $photo=GETPOST("photo", 'alpha'); + $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); + $login = GETPOST("member_login", 'alpha'); + $pass = GETPOST("password", 'alpha'); + $photo = GETPOST("photo", 'alpha'); //$comment=GETPOST("comment",'none'); - $morphy=GETPOST("morphy", 'alpha'); - $subscription=GETPOST("subscription", 'alpha'); - $public=GETPOST("public", 'alpha'); + $morphy = GETPOST("morphy", 'alpha'); + $subscription = GETPOST("subscription", 'alpha'); + $public = GETPOST("public", 'alpha'); - $userid=GETPOST("userid", 'int'); - $socid=GETPOST("socid", 'int'); + $userid = GETPOST("userid", 'int'); + $socid = GETPOST("socid", 'int'); $object->civility_id = $civility_id; $object->firstname = $firstname; $object->lastname = $lastname; $object->gender = $gender; - $object->societe = $societe; // deprecated + $object->societe = $societe; // deprecated $object->company = $societe; $object->address = $address; $object->zip = $zip; @@ -485,11 +485,11 @@ if (empty($reshook)) $object->country_id = $country_id; $object->phone = $phone; $object->phone_perso = $phone_perso; - $object->phone_mobile= $phone_mobile; + $object->phone_mobile = $phone_mobile; $object->socialnetworks = array(); - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml'); } } @@ -509,7 +509,7 @@ if (empty($reshook)) //$object->note = $comment; $object->morphy = $morphy; $object->user_id = $userid; - $object->socid = $socid; + $object->socid = $socid; $object->public = $public; // Fill array 'array_options' with data from add form @@ -555,29 +555,29 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors'); } - if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); } - if (! ($typeid > 0)) { // Keep () before ! + if (!($typeid > 0)) { // Keep () before ! $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); } - if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { + if ($conf->global->ADHERENT_MAIL_REQUIRED && !isValidEMail($email)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors'); } - $public=0; - if (isset($public)) $public=1; + $public = 0; + if (isset($public)) $public = 1; - if (! $error) + if (!$error) { $db->begin(); // Email about right and login does not exist - $result=$object->create($user); + $result = $object->create($user); if ($result > 0) { // Foundation categories @@ -585,9 +585,9 @@ if (empty($reshook)) $object->setCategories($memcats); $db->commit(); - $rowid=$object->id; - $id=$object->id; - $action=''; + $rowid = $object->id; + $id = $object->id; + $action = ''; } else { @@ -609,10 +609,10 @@ if (empty($reshook)) if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { - $result=$object->delete($id, $user); + $result = $object->delete($id, $user); if ($result > 0) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -625,44 +625,44 @@ if (empty($reshook)) } else { - $errmesg=$object->error; + $errmesg = $object->error; } } if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') { - $error=0; + $error = 0; $db->begin(); $adht = new AdherentType($db); $adht->fetch($object->typeid); - $result=$object->validate($user); + $result = $object->validate($user); - if ($result >= 0 && ! count($object->errors)) + if ($result >= 0 && !count($object->errors)) { // Send confirmation email (according to parameters of member type. Otherwise generic) if ($object->email && GETPOST("send_mail")) { $subject = ''; - $msg= ''; + $msg = ''; // Send subscription email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); + $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template - $arraydefaultmessage=null; + $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; - if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; @@ -674,14 +674,14 @@ if (empty($reshook)) $error++; } else { - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; @@ -700,7 +700,7 @@ if (empty($reshook)) } } - if (! $error) + if (!$error) { $db->commit(); } @@ -708,7 +708,7 @@ if (empty($reshook)) { $db->rollback(); } - $action=''; + $action = ''; } if ($user->rights->adherent->supprimer && $action == 'confirm_resign') @@ -720,30 +720,30 @@ if (empty($reshook)) $adht = new AdherentType($db); $adht->fetch($object->typeid); - $result=$object->resiliate($user); + $result = $object->resiliate($user); - if ($result >= 0 && ! count($object->errors)) + if ($result >= 0 && !count($object->errors)) { if ($object->email && GETPOST("send_mail")) { $subject = ''; - $msg= ''; + $msg = ''; // Send subscription email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); + $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template - $arraydefaultmessage=null; + $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; - if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; @@ -755,14 +755,14 @@ if (empty($reshook)) $error++; } else { - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); - $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; @@ -780,10 +780,10 @@ if (empty($reshook)) } else { setEventMessages($object->error, $object->errors, 'errors'); } - $action=''; + $action = ''; } } - if (! empty($backtopage) && ! $error) + if (!empty($backtopage) && !$error) { header("Location: ".$backtopage); exit; @@ -793,7 +793,7 @@ if (empty($reshook)) // SPIP Management if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') { - if (! count($object->errors)) + if (!count($object->errors)) { if (!$mailmanspip->del_to_spip($object)) { @@ -804,7 +804,7 @@ if (empty($reshook)) if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') { - if (! count($object->errors)) + if (!count($object->errors)) { if (!$mailmanspip->add_to_spip($object)) { @@ -818,14 +818,14 @@ if (empty($reshook)) // Actions to build doc $upload_dir = $conf->adherent->dir_output; - $permissiontoadd=$user->rights->adherent->creer; + $permissiontoadd = $user->rights->adherent->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails - $trigger_name='MEMBER_SENTBYMAIL'; - $paramname='id'; - $mode='emailfrommember'; - $trackid='mem'.$object->id; + $trigger_name = 'MEMBER_SENTBYMAIL'; + $paramname = 'id'; + $mode = 'emailfrommember'; + $trackid = 'mem'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -838,11 +838,11 @@ $form = new Form($db); $formfile = new FormFile($db); $formcompany = new FormCompany($db); -$title=$langs->trans("Member") . " - " . $langs->trans("Card"); -$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +$title = $langs->trans("Member")." - ".$langs->trans("Card"); +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('', $title, $help_url); -$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; +$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { @@ -852,11 +852,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (empty($object->error) && $id) { $object = new Adherent($db); - $result=$object->fetch($id); + $result = $object->fetch($id); if ($result <= 0) dol_print_error('', $object->error); } - $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates - $objcanvas->display_canvas($action); // Show template + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template } else { @@ -871,23 +871,23 @@ else /* Creation mode */ /* */ /* ************************************************************************** */ - $object->canvas=$canvas; + $object->canvas = $canvas; $object->state_id = GETPOST('state_id', 'int'); // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id', 'int')?GETPOST('country_id', 'int'):$mysoc->country_id; + $object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id; if ($object->country_id) { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; + $tmparray = getCountry($object->country_id, 'all'); + $object->country_code = $tmparray['code']; + $object->country = $tmparray['label']; } if (!empty($socid)) { $object = new Societe($db); if ($socid > 0) $object->fetch($socid); - if (! ($object->id > 0)) + if (!($object->id > 0)) { $langs->load("errors"); print($langs->trans('ErrorRecordNotFound')); @@ -944,14 +944,14 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print '