--- /tmp/dsg/dolibarr/htdocs/adherents/github_agenda.php +++ /tmp/dsg/dolibarr/htdocs/adherents/client_agenda.php @@ -49,10 +49,13 @@ if (!$sortfield) $sortfield = 'a.datep,a.id'; if (!$sortorder) $sortorder = 'DESC'; -if (GETPOST('actioncode', 'array')) { +if (GETPOST('actioncode', 'array')) +{ $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} else { +} +else +{ $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -62,11 +65,12 @@ $object = new Adherent($db); $result = $object->fetch($id); -if ($result > 0) { +if ($result > 0) +{ $object->fetch_thirdparty(); - $adht = new AdherentType($db); - $result = $adht->fetch($object->typeid); + $adht = new AdherentType($db); + $result = $adht->fetch($object->typeid); } @@ -78,18 +82,21 @@ $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)) { - // Cancel - if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { - header("Location: ".$backtopage); - exit; - } +if (empty($reshook)) +{ + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } - // Purge search criteria - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers - $actioncode = ''; - $search_agenda_label = ''; - } + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers + { + $actioncode = ''; + $search_agenda_label = ''; + } } @@ -105,7 +112,8 @@ /* * Customer and/or supplier category sheet */ -if ($object->id > 0) { +if ($object->id > 0) +{ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -118,7 +126,7 @@ if (!empty($conf->notification->enabled)) $langs->load("mails"); $head = member_prepare_head($object); - print dol_get_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user'); + dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; @@ -133,34 +141,36 @@ print ''; - print dol_get_fiche_end(); + dol_fiche_end(); - //print '
'; - //print '
'; + //print '
'; + //print '
'; $newcardbutton = ''; - if (!empty($conf->agenda->enabled)) { - $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); - } + if (!empty($conf->agenda->enabled)) + { + $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id); + } - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { - print '
'; + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) + { + print '
'; - $param = '&id='.$id; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; + $param = '&id='.$id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1); - // List of all actions - $filters = array(); - $filters['search_agenda_label'] = $search_agenda_label; + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; - // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); - } + // TODO Replace this with same code than into list.php + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + } } // End of page --- /tmp/dsg/dolibarr/htdocs/adherents/github_card.php +++ /tmp/dsg/dolibarr/htdocs/adherents/client_card.php @@ -4,9 +4,9 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2012-2020 Philippe Grand + * Copyright (C) 2012-2018 Philippe Grand * Copyright (C) 2015-2018 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018 Frédéric France * * 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 @@ -25,7 +25,7 @@ /** * \file htdocs/adherents/card.php * \ingroup member - * \brief Page of a member + * \brief Page of member */ require '../main.inc.php'; @@ -45,7 +45,7 @@ // Load translation files required by the page $langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal")); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); @@ -55,7 +55,8 @@ $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'; $langs->load('mailmanspip'); @@ -75,23 +76,26 @@ $object->getCanvas($id); $canvas = $object->canvas ? $object->canvas : GETPOST("canvas"); $objcanvas = null; -if (!empty($canvas)) { +if (!empty($canvas)) +{ require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); $objcanvas->getCanvas('adherent', 'membercard', $canvas); } // Security check -$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0); - -if ($id > 0) { +$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); + +if ($id > 0) +{ // Load member $result = $object->fetch($id); // Define variables to know what current user can do on users $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) { + 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) || (($user->id != $object->user_id) && $user->rights->user->user->creer)); @@ -103,7 +107,8 @@ // Define variables to determine what the current user can do on the members $canaddmember = $user->rights->adherent->creer; // Define variables to determine what the current user can do on the properties of a member -if ($id) { +if ($id) +{ $caneditfieldmember = $user->rights->adherent->creer; } @@ -120,26 +125,34 @@ $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($reshook)) +{ + if ($cancel) + { + if (!empty($backtopage)) + { header("Location: ".$backtopage); exit; } $action = ''; } - if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { + if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) + { $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) { + 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) + { $error++; setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); } } - if (!$error) { - if ($userid != $object->user_id) { // If link differs from currently in database + if (!$error) + { + if ($userid != $object->user_id) // If link differs from currently in database + { $result = $object->setUserId($userid); if ($result < 0) dol_print_error($object->db, $object->error); $action = ''; @@ -147,17 +160,22 @@ } } - if ($action == 'setsocid') { + if ($action == 'setsocid') + { $error = 0; - if (!$error) { - if ($socid != $object->socid) { // If link differs from currently in database + if (!$error) + { + if ($socid != $object->socid) // If link differs from currently in database + { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; - $sql .= " WHERE socid = ".((int) $socid); + $sql .= " WHERE socid = '".$socid."'"; $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) { + if ($resql) + { $obj = $db->fetch_object($resql); - if ($obj && $obj->rowid > 0) { + if ($obj && $obj->rowid > 0) + { $othermember = new Adherent($db); $othermember->fetch($obj->rowid); $thirdparty = new Societe($db); @@ -167,7 +185,8 @@ } } - if (!$error) { + if (!$error) + { $result = $object->setThirdPartyId($socid); if ($result < 0) dol_print_error($object->db, $object->error); $action = ''; @@ -177,51 +196,54 @@ } // Create user from a member - if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) { - if ($result > 0) { + if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) + { + if ($result > 0) + { // Creation user $nuser = new User($db); - $tmpuser = dol_clone($object); - if (GETPOST('internalorexternal', 'aZ09') == 'internal') { - $tmpuser->fk_soc = 0; - } - - $result = $nuser->create_from_member($tmpuser, GETPOST('login', 'alphanohtml')); - - if ($result < 0) { + $result = $nuser->create_from_member($object, GETPOST('login', 'alphanohtml')); + + if ($result < 0) + { $langs->load("errors"); setEventMessages($langs->trans($nuser->error), null, 'errors'); - } else { - setEventMessages($langs->trans("NewUserCreated", $nuser->login), null, 'mesgs'); - $action = ''; - } - } else { + } + } + else + { setEventMessages($object->error, $object->errors, 'errors'); } } // Create third party from a member - if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) { - if ($result > 0) { + if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) + { + if ($result > 0) + { // User creation $company = new Societe($db); $result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha')); - if ($result < 0) { + if ($result < 0) + { $langs->load("errors"); setEventMessages($langs->trans($company->error), null, 'errors'); setEventMessages($company->error, $company->errors, 'errors'); } - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); } } - 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 = ''; - if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int')) + if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int')) { $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); } @@ -247,14 +269,16 @@ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); } // Check if the login already exists - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { if (empty($login)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } } // Create new object - if ($result > 0 && !$error) { + if ($result > 0 && !$error) + { $object->oldcopy = clone $object; // Change values @@ -262,7 +286,7 @@ $object->firstname = trim(GETPOST("firstname", 'alphanohtml')); $object->lastname = trim(GETPOST("lastname", 'alphanohtml')); $object->gender = trim(GETPOST("gender", 'alphanohtml')); - $object->login = trim(GETPOST("login", 'alphanohtml')); + $object->login = trim(GETPOST("login", 'alpha')); $object->pass = trim(GETPOST("pass", 'alpha')); $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated @@ -307,27 +331,32 @@ // Check if we need to also synchronize user information $nosyncuser = 0; - if ($object->user_id) { // If linked to a user + 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 } // Check if we need to also synchronize password information $nosyncuserpass = 0; - if ($object->user_id) { // If linked to a user + 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 } $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'; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); - if ($file_OK) { - if (GETPOST('deletephoto')) { + 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'; @@ -335,23 +364,33 @@ dol_delete_dir_recursive($dirthumbs); } - if (image_format_supported($_FILES['photo']['name']) > 0) { + if (image_format_supported($_FILES['photo']['name']) > 0) + { dol_mkdir($dir); - if (@is_dir($dir)) { + 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) { + if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) + { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); - } else { - // Create thumbs - $object->addThumbs($newfile); + } + else + { + // Create thumbs + $object->addThumbs($newfile); } } - } else { + } + else + { setEventMessages("ErrorBadImageFormat", null, 'errors'); } - } else { - switch ($_FILES['photo']['error']) { + } + else + { + 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 $errors[] = "ErrorFileSizeTooLarge"; @@ -362,32 +401,42 @@ } } - $rowid = $object->id; - $id = $object->id; + $rowid = $object->id; + $id = $object->id; $action = ''; - if (!empty($backtopage)) { + if (!empty($backtopage)) + { header("Location: ".$backtopage); exit; } - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } - } else { + } + else + { $action = 'edit'; } } - if ($action == 'add' && $user->rights->adherent->creer) { + if ($action == 'add' && $user->rights->adherent->creer) + { if ($canvas) $object->canvas = $canvas; $birthdate = ''; - if (GETPOSTISSET("birthday") && GETPOST("birthday") && GETPOSTISSET("birthmonth") && GETPOST("birthmonth") && GETPOSTISSET("birthyear") && GETPOST("birthyear")) { - $birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); + 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"]); } $datesubscription = ''; - if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) { - $datesubscription = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", "int"), GETPOST("reyear", "int")); + if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) + { + $datesubscription = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } $typeid = GETPOST("typeid", 'int'); @@ -408,11 +457,12 @@ // $skype=GETPOST("member_skype", 'alpha'); // $twitter=GETPOST("member_twitter", 'alpha'); // $facebook=GETPOST("member_facebook", 'alpha'); - // $linkedin=GETPOST("member_linkedin", 'alpha'); + // $linkedin=GETPOST("member_linkedin", 'alpha'); $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); - $login = GETPOST("member_login", 'alphanohtml'); + $login = GETPOST("member_login", 'alpha'); $pass = GETPOST("password", 'alpha'); $photo = GETPOST("photo", 'alpha'); + //$comment=GETPOST("comment",'none'); $morphy = GETPOST("morphy", 'alphanohtml'); $public = GETPOST("public", 'alphanohtml'); @@ -469,11 +519,13 @@ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MemberNature")), null, 'errors'); } // Tests if the login already exists - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { if (empty($login)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); - } else { + } + else { $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; $result = $db->query($sql); if ($result) { @@ -517,12 +569,14 @@ $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); - if ($result > 0) { + if ($result > 0) + { // Foundation categories $memcats = GETPOST('memcats', 'array'); $object->setCategories($memcats); @@ -531,7 +585,9 @@ $rowid = $object->id; $id = $object->id; $action = ''; - } else { + } + else + { $db->rollback(); if ($object->error) { @@ -542,27 +598,36 @@ $action = 'create'; } - } else { + } + else { $action = 'create'; } } - if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { + if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') + { $result = $object->delete($id, $user); - if ($result > 0) { - if (!empty($backtopage)) { + if ($result > 0) + { + if (!empty($backtopage)) + { header("Location: ".$backtopage); exit; - } else { + } + else + { header("Location: list.php"); exit; } - } else { + } + else + { $errmesg = $object->error; } } - if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') { + if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') + { $error = 0; $db->begin(); @@ -572,9 +637,11 @@ $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")) { + if ($object->email && GETPOST("send_mail")) + { $subject = ''; $msg = ''; @@ -592,7 +659,8 @@ 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; } @@ -601,7 +669,8 @@ //fallback on the old configuration. setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); $error++; - } else { + } + else { $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); @@ -610,13 +679,16 @@ $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); - if ($result < 0) { + if ($result < 0) + { $error++; setEventMessages($object->error, $object->errors, 'errors'); } } } - } else { + } + else + { $error++; if ($object->error) { setEventMessages($object->error, $object->errors, 'errors'); @@ -625,25 +697,32 @@ } } - if (!$error) { + if (!$error) + { $db->commit(); - } else { + } + else + { $db->rollback(); } $action = ''; } - if ($user->rights->adherent->supprimer && $action == 'confirm_resign') { + if ($user->rights->adherent->supprimer && $action == 'confirm_resign') + { $error = 0; - if ($confirm == 'yes') { + if ($confirm == 'yes') + { $adht = new AdherentType($db); $adht->fetch($object->typeid); $result = $object->resiliate($user); - if ($result >= 0 && !count($object->errors)) { - if ($object->email && GETPOST("send_mail")) { + if ($result >= 0 && !count($object->errors)) + { + if ($object->email && GETPOST("send_mail")) + { $subject = ''; $msg = ''; @@ -661,7 +740,8 @@ 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; } @@ -670,7 +750,8 @@ //fallback on the old configuration. setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); $error++; - } else { + } + else { $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); @@ -679,13 +760,16 @@ $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); - if ($result < 0) { + if ($result < 0) + { $error++; setEventMessages($object->error, $object->errors, 'errors'); } } } - } else { + } + else + { $error++; if ($object->error) { @@ -696,24 +780,31 @@ $action = ''; } } - if (!empty($backtopage) && !$error) { + if (!empty($backtopage) && !$error) + { header("Location: ".$backtopage); exit; } } // SPIP Management - if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') { - if (!count($object->errors)) { - if (!$mailmanspip->del_to_spip($object)) { + if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') + { + if (!count($object->errors)) + { + if (!$mailmanspip->del_to_spip($object)) + { setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors'); } } } - if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') { - if (!count($object->errors)) { - if (!$mailmanspip->add_to_spip($object)) { + if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') + { + if (!count($object->errors)) + { + if (!$mailmanspip->add_to_spip($object)) + { setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors'); } } @@ -750,23 +841,28 @@ $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) +{ // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - if (empty($object->error) && $id) { + if (empty($object->error) && $id) + { $object = new Adherent($db); $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 -} else { + $objcanvas->display_canvas($action); // Show template +} +else +{ // ----------------------------------------- // When used in standard mode // ----------------------------------------- - if ($action == 'create') { + if ($action == 'create') + { /* ************************************************************************** */ /* */ /* Creation mode */ @@ -777,28 +873,31 @@ // 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; - if ($object->country_id) { + if ($object->country_id) + { $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)) { - $langs->load("errors"); - print($langs->trans('ErrorRecordNotFound')); - exit; - } - } + if (!empty($socid)) { + $object = new Societe($db); + if ($socid > 0) $object->fetch($socid); + + if (!($object->id > 0)) + { + $langs->load("errors"); + print($langs->trans('ErrorRecordNotFound')); + exit; + } + } $adht = new AdherentType($db); print load_fiche_titre($langs->trans("NewMember"), '', 'members'); - if ($conf->use_javascript_ajax) { + if ($conf->use_javascript_ajax) + { print "\n".''."\n"; - } + if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);'; + print '});'; + print ''."\n"; + } // Confirm create third party - if ($action == 'create_thirdparty') { + if ($action == 'create_thirdparty') + { $companyalias = ''; $fullname = $object->getFullName($langs); - if ($object->morphy == 'mor') { + if ($object->morphy == 'mor') + { $companyname = $object->company; if (!empty($fullname)) $companyalias = $fullname; - } else { + } + else + { $companyname = $fullname; if (!empty($object->company)) $companyalias = $object->company; } @@ -808,19 +883,20 @@ array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"') ); // If customer code was forced to "required", we ask it at creation to avoid error later - if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) { + if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) + { $tmpcompany = new Societe($db); $tmpcompany->name = $companyname; - $tmpcompany->get_codeclient($tmpcompany, 0); + $tmpcompany->get_codeclient($tmpcompany, 0); $customercode = $tmpcompany->code_client; $formquestion[] = array( - 'label' => $langs->trans("CustomerCode"), - 'type' => 'text', - 'name' => 'customercode', - 'value' => $customercode, - 'morecss' => 'minwidth300', - 'moreattr' => 'maxlength="128"', - ); + 'label' => $langs->trans("CustomerCode"), + 'type' => 'text', + 'name' => 'customercode', + 'value' => $customercode, + 'morecss' => 'minwidth300', + 'moreattr' => 'maxlength="128"', + ); } // @todo Add other extrafields mandatory for thirdparty creation @@ -828,249 +904,265 @@ } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print dol_get_fiche_head(''); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head(''); print "\n"; - print ''; + print ''; $today = dol_now(); - $datefrom = 0; - $dateto = 0; - $paymentdate = -1; - - // Date payment - if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { - $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); - } - - print ''; - // Date start subscription - print '"; - - // Date end subscription - if (GETPOST('endday')) { - $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - } - if (!$dateto) { - $dateto = -1; // By default, no date is suggested - } - print '"; - - if ($adht->subscription) { - // Amount - print ''; - - // Label - print ''; - print ''; - - // Complementary action - if ((!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { - $company = new Societe($db); - if ($object->fk_soc) { - $result = $company->fetch($object->fk_soc); - } - - // Title payments - //print ''; - - // No more action - print ''; - print ''; + // Date start subscription + print '"; + + // Date end subscription + if (GETPOST('endday')) + { + $dateto = dol_mktime(0, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + } + if (!$dateto) + { + $dateto = -1; // By default, no date is suggested + } + print '"; + + if ($adht->subscription) + { + // Amount + print ''; + + // Label + print ''; + print ''; + + // Complementary action + if (!empty($conf->banque->enabled) || !empty($conf->facture->enabled)) + { + $company = new Societe($db); + if ($object->fk_soc) + { + $result = $company->fetch($object->fk_soc); + } + + // Title payments + //print ''; + + // No more action + print ''; + print ''; - - // Bank account - print '\n"; - - // Payment mode - print '\n"; - - // Date of payment - print '\n"; - - print ''; - print ''; - - print ''; - print ''; - - print ''; - print ''; - } - } - - print ''; - - print ''; - print ''; - print ''; - print '
'.$langs->trans("DateSubscription").''; - if (GETPOST('reday')) { - $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - } - if (!$datefrom) { - $datefrom = $object->datevalid; - if ($object->datefin > 0) { - $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); - } - } - print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); - print "
'.$langs->trans("DateEndSubscription").''; - print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); - print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("Label").'
'.$langs->trans("Payment").'
'.$langs->trans('MoreActions'); - print ''; - print ' '.$langs->trans("None").'
'; - // Add entry into bank accoun - if (!empty($conf->banque->enabled)) { - print ' '.$langs->trans("MoreActionBankDirect").'
'; - } - // Add invoice with no payments - if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { - print 'fk_soc)) print ' disabled'; - print '> '.$langs->trans("MoreActionInvoiceOnly"); - if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; - else { - print ' ('; - if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); - print $langs->trans("NoThirdPartyAssociatedToMember"); - print ' - '; - print $langs->trans("CreateDolibarrThirdParty"); - print ')'; - } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; - if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { + $datefrom = 0; + $dateto = 0; + $paymentdate = -1; + + // Date payment + if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) + { + $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); + } + + print '
'.$langs->trans("DateSubscription").''; + if (GETPOST('reday')) + { + $datefrom = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + } + if (!$datefrom) + { + $datefrom = $object->datevalid; + if ($object->datefin > 0) + { + $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); + } + } + print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); + print "
'.$langs->trans("DateEndSubscription").''; + print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0); + print "
'.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).'
'.$langs->trans("Label").'
'.$langs->trans("Payment").'
'.$langs->trans('MoreActions'); + print ''; + print ' '.$langs->trans("None").'
'; + // Add entry into bank accoun + if (!empty($conf->banque->enabled)) + { + print ' '.$langs->trans("MoreActionBankDirect").'
'; + } + // Add invoice with no payments + if (!empty($conf->societe->enabled) && !empty($conf->facture->enabled)) + { + print 'fk_soc)) print ' disabled'; + print '> '.$langs->trans("MoreActionInvoiceOnly"); + if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; + else + { + print ' ('; + if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); + print $langs->trans("NoThirdPartyAssociatedToMember"); + print ' - '; + print $langs->trans("CreateDolibarrThirdParty"); + print ')'; + } + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; + if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) + { $prodtmp = new Product($db); - $result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); - if ($result < 0) { - setEventMessage($prodtmp->error, 'errors'); - } + $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product } - print '
'; - } - // Add invoice with payments - if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) { - print 'fk_soc)) print ' disabled'; - print '> '.$langs->trans("MoreActionBankViaInvoice"); - if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; - else { - print ' ('; - if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); - print $langs->trans("NoThirdPartyAssociatedToMember"); - print ' - '; - print $langs->trans("CreateDolibarrThirdParty"); - print ')'; - } - if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; - if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { + print '
'; + } + // Add invoice with payments + if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) + { + print 'fk_soc)) print ' disabled'; + print '> '.$langs->trans("MoreActionBankViaInvoice"); + if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; + else + { + print ' ('; + if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); + print $langs->trans("NoThirdPartyAssociatedToMember"); + print ' - '; + print $langs->trans("CreateDolibarrThirdParty"); + print ')'; + } + if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; + if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) + { $prodtmp = new Product($db); - $result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); - if ($result < 0) { - setEventMessage($prodtmp->error, 'errors'); - } + $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product } - print '
'; - } - print '
'.$langs->trans("FinancialAccount").''; - $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2); - print "
'.$langs->trans("PaymentMode").''; - $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2); - print "
'.$langs->trans("DatePayment").''; - print $form->selectDate(isset($paymentdate) ? $paymentdate : -1, 'payment', 0, 0, 1, 'subscription', 1, 1); - print "
'.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; - print '
'.$langs->trans('CheckTransmitter'); - print ' ('.$langs->trans("ChequeMaker").')'; - print '
'.$langs->trans('Bank'); - print ' ('.$langs->trans("ChequeBank").')'; - print '
'.$langs->trans("SendAcknowledgementByMail").''; - if (!$object->email) { - print $langs->trans("NoEMail"); - } else { - $adht = new AdherentType($db); - $adht->fetch($object->typeid); - - // Send subscription email - $subject = ''; - $msg = ''; - - // Send subscription email - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $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; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; - - if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $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->getMailOnSubscription()), $substitutionarray, $outputlangs); - - $tmp = 'global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>'; - $helpcontent = ''; - $helpcontent .= ''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; - $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent .= ''.$langs->trans("MailTopic").':
'."\n"; - if ($subjecttosend) { - $helpcontent .= $subjecttosend."\n"; - } else { - $langs->load("errors"); - $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; - } - $helpcontent .= "
"; - $helpcontent .= ''.$langs->trans("MailText").':
'; - if ($texttosend) { - $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; - } else { - $langs->load("errors"); - $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; - } - print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); - } - print '
'; - - print dol_get_fiche_end(); - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; - - print "\n\n\n"; - } - - //print ''; - //print ''; -} else { - $langs->load("errors"); - print $langs->trans("ErrorRecordNotFound"); + print '
'; + } + print ''; + + // Bank account + print ''.$langs->trans("FinancialAccount").''; + $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 1); + print "\n"; + + // Payment mode + print ''.$langs->trans("PaymentMode").''; + $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2); + print "\n"; + + // Date of payment + print ''.$langs->trans("DatePayment").''; + print $form->selectDate(isset($paymentdate) ? $paymentdate : -1, 'payment', 0, 0, 1, 'subscription', 1, 1); + print "\n"; + + print ''.$langs->trans('Numero'); + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print ''; + print ''; + + print ''.$langs->trans('CheckTransmitter'); + print ' ('.$langs->trans("ChequeMaker").')'; + print ''; + print ''; + + print ''.$langs->trans('Bank'); + print ' ('.$langs->trans("ChequeBank").')'; + print ''; + print ''; + } + } + + print ''; + + print ''.$langs->trans("SendAcknowledgementByMail").''; + print ''; + if (!$object->email) + { + print $langs->trans("NoEMail"); + } + else + { + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + // Send subscription email + $subject = ''; + $msg = ''; + + // Send subscription email + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $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; + $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; + + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $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->getMailOnSubscription()), $substitutionarray, $outputlangs); + + $tmp = 'global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? ' checked' : '')).'>'; + $helpcontent = ''; + $helpcontent .= ''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent .= ''.$langs->trans("MailTopic").':
'."\n"; + if ($subjecttosend) { + $helpcontent .= $subjecttosend."\n"; + } else { + $langs->load("errors"); + $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; + } + $helpcontent .= "
"; + $helpcontent .= ''.$langs->trans("MailText").':
'; + if ($texttosend) { + $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; + } else { + $langs->load("errors"); + $helpcontent .= ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).''."\n"; + } + print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); + } + print ''; + print ''; + print ''; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print ''; + + print "\n\n\n"; + } + + //print ''; + //print ''; +} +else +{ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); } // End of page --- /tmp/dsg/dolibarr/htdocs/adherents/github_type.php +++ /tmp/dsg/dolibarr/htdocs/adherents/client_type.php @@ -38,7 +38,7 @@ $langs->load("members"); $rowid = GETPOST('rowid', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -61,13 +61,13 @@ $label = GETPOST("label", "alpha"); $morphy = GETPOST("morphy", "alpha"); -$status = GETPOST("status", "int"); +$statut = GETPOST("statut", "int"); $subscription = GETPOST("subscription", "int"); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); -$comment = GETPOST("comment", 'restricthtml'); -$mail_valid = GETPOST("mail_valid", 'restricthtml'); +$comment = GETPOST("comment", 'none'); +$mail_valid = GETPOST("mail_valid", 'none'); // Security check $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); @@ -79,12 +79,13 @@ // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_lastname = ""; - $search_login = ""; - $search_email = ""; - $type = ""; - $sall = ""; +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers +{ + $search_lastname = ""; + $search_login = ""; + $search_email = ""; + $type = ""; + $sall = ""; } @@ -108,7 +109,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); $object->morphy = trim($morphy); - $object->status = (int) $status; + $object->statut = (int) $statut; $object->subscription = (int) $subscription; $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; @@ -123,7 +124,8 @@ if (empty($object->label)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); - } else { + } + else { $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'"; $result = $db->query($sql); if ($result) { @@ -136,28 +138,35 @@ } } - if (!$error) { + if (!$error) + { $id = $object->create($user); - if ($id > 0) { + if ($id > 0) + { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } - } else { + } + else + { $action = 'create'; } } -if ($action == 'update' && $user->rights->adherent->configurer) { +if ($action == 'update' && $user->rights->adherent->configurer) +{ $object->fetch($rowid); $object->oldcopy = clone $object; $object->label = trim($label); $object->morphy = trim($morphy); - $object->status = (int) $status; + $object->statut = (int) $statut; $object->subscription = (int) $subscription; $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; @@ -171,9 +180,12 @@ $ret = $object->update($user); - if ($ret >= 0 && !count($object->errors)) { + if ($ret >= 0 && !count($object->errors)) + { setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs'); - } else { + } + else + { setEventMessages($object->error, $object->errors, 'errors'); } @@ -181,15 +193,19 @@ exit; } -if ($action == 'confirm_delete' && $user->rights->adherent->configurer) { +if ($action == 'confirm_delete' && $user->rights->adherent->configurer) +{ $object->fetch($rowid); $res = $object->delete(); - if ($res > 0) { + if ($res > 0) + { setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; - } else { + } + else + { setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors'); $action = ''; } @@ -205,16 +221,19 @@ llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); + // List of members type -if (!$rowid && $action != 'create' && $action != 'edit') { - //print dol_get_fiche_head(''); +if (!$rowid && $action != 'create' && $action != 'edit') +{ + //dol_fiche_head(''); $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut as status, d.morphy"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")"; $result = $db->query($sql); - if ($result) { + if ($result) + { $num = $db->num_rows($result); $nbtotalofrecords = $num; @@ -225,9 +244,10 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $newcardbutton = ''; - if ($user->rights->adherent->configurer) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); - } + if ($user->rights->adherent->configurer) + { + $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); + } print '
'; if ($optioncss != '') print ''; @@ -247,7 +267,7 @@ print ''; print ''.$langs->trans("Ref").''; print ''.$langs->trans("Label").''; - print ''.$langs->trans("MembersNature").''; + print ''.$langs->trans("MemberNature").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("VoteAllowed").''; print ''.$langs->trans("Status").''; @@ -263,7 +283,6 @@ $membertype->ref = $objp->rowid; $membertype->label = $objp->rowid; $membertype->status = $objp->status; - $membertype->subscription = $objp->subscription; print ''; print ''; @@ -271,17 +290,18 @@ //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' print ''; print ''.dol_escape_htmltag($objp->label).''; - print ''; - if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorAndPhy"); - print ''; + print ''; + if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } + elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } + else print $langs->trans("MorPhy"); + print ''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) print 'rowid.'">'.img_edit().''; - else { + else print ' '; - } print ""; $i++; } @@ -289,7 +309,9 @@ print ''; print '
'; - } else { + } + else + { dol_print_error($db); } } @@ -300,7 +322,8 @@ /* Creation mode */ /* */ /* ************************************************************************** */ -if ($action == 'create') { +if ($action == 'create') +{ $object = new AdherentType($db); print load_fiche_titre($langs->trans("NewMemberType"), '', 'members'); @@ -309,7 +332,7 @@ print ''; print ''; - print dol_get_fiche_head(''); + dol_fiche_head(''); print ''; print ''; @@ -317,15 +340,15 @@ print ''; print ''; - // Morphy + // Morphy $morphys = array(); - $morphys[""] = $langs->trans("MorAndPhy"); - $morphys["phy"] = $langs->trans("Physical"); + $morphys[""] = $langs->trans("MorPhy"); + $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); - print '"; @@ -344,12 +367,12 @@ print ''; @@ -359,12 +382,12 @@ print ''; print "
'.$langs->trans("Label").'
'.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1); + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1); print '
'.$langs->trans("MembersNature").''; + print '
'.$langs->trans("MemberNature").''; print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy'); print "
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print '
'.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print '
\n"; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; print ''; print '     '; - print ''; + print ''; print '
'; print "\n"; @@ -375,8 +398,10 @@ /* View mode */ /* */ /* ************************************************************************** */ -if ($rowid > 0) { - if ($action != 'edit') { +if ($rowid > 0) +{ + if ($action != 'edit') + { $object = new AdherentType($db); $object->fetch($rowid); $object->fetch_optionals(); @@ -384,13 +409,14 @@ /* * Confirmation deletion */ - if ($action == 'delete') { + if ($action == 'delete') + { print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id, $langs->trans("DeleteAMemberType"), $langs->trans("ConfirmDeleteMemberType", $object->label), "confirm_delete", '', 0, 1); } $head = member_type_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group'); + dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group'); $linkback = ''.$langs->trans("BackToList").''; @@ -402,7 +428,7 @@ print ''; // Morphy - print ''; + print ''; print ''; print ''; print '
'.$langs->trans("MembersNature").''.$object->getmorphylib($object->morphy).'
'.$langs->trans("MemberNature").''.$object->getmorphylib($object->morphy).'
'.$langs->trans("SubscriptionRequired").''; @@ -414,9 +440,12 @@ print '
'.$langs->trans("Duration").''.$object->duration_value.' '; - if ($object->duration_value > 1) { + if ($object->duration_value > 1) + { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); - } elseif ($object->duration_value > 0) { + } + elseif ($object->duration_value > 0) + { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; @@ -434,7 +463,7 @@ print '
'; print ''; - print dol_get_fiche_end(); + dol_fiche_end(); /* * Buttons @@ -443,20 +472,23 @@ print '
'; // Edit - if ($user->rights->adherent->configurer) { + if ($user->rights->adherent->configurer) + { print ''; } // Add - if ($user->rights->adherent->configurer && !empty($object->status)) { - print ''; - } else { - print ''; - } + if ($user->rights->adherent->configurer && !empty($object->statut)) + { + print ''; + } else { + print ''; + } // Delete - if ($user->rights->adherent->configurer) { - print ''; + if ($user->rights->adherent->configurer) + { + print ''; } print "
"; @@ -470,110 +502,120 @@ $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,"; $sql .= " d.datefin,"; - $sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; + $sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql .= " t.libelle as type, t.subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE d.fk_adherent_type = t.rowid "; $sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND t.rowid = ".$object->id; - if ($sall) { + if ($sall) + { $sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall); } - if ($status != '') { - $sql .= natural_search('d.statut', $status, 2); - } - if ($action == 'search') { - if (GETPOST('search', 'alpha')) { + if ($status != '') + { + $sql .= natural_search('d.statut', $status, 2); + } + if ($action == 'search') + { + if (GETPOST('search', 'alpha')) + { $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha')); } } - if (!empty($search_lastname)) { + if (!empty($search_lastname)) + { $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname); } - if (!empty($search_login)) { + if (!empty($search_login)) + { $sql .= natural_search("d.login", $search_login); } - if (!empty($search_email)) { + if (!empty($search_email)) + { $sql .= natural_search("d.email", $search_email); } - if ($filter == 'uptodate') { - $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; - } - if ($filter == 'outofdate') { - $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; - } + if ($filter == 'uptodate') + { + $sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; + } + if ($filter == 'outofdate') + { + $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; + } $sql .= " ".$db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { $resql = $db->query($sql); - if ($resql) $nbtotalofrecords = $db->num_rows($result); - else dol_print_error($db); - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 - $page = 0; - $offset = 0; - } + if ($resql) $nbtotalofrecords = $db->num_rows($result); + else dol_print_error($db); + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + { + $page = 0; + $offset = 0; + } } $sql .= " ".$db->plimit($conf->liste_limit + 1, $offset); $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - $titre = $langs->trans("MembersList"); - if ($status != '') { - if ($status == '-1,1') { - $titre = $langs->trans("MembersListQualified"); - } elseif ($status == '-1') { - $titre = $langs->trans("MembersListToValid"); - } elseif ($status == '1' && !$filter) { - $titre = $langs->trans("MembersListValid"); - } elseif ($status == '1' && $filter == 'uptodate') { - $titre = $langs->trans("MembersListUpToDate"); - } elseif ($status == '1' && $filter == 'outofdate') { - $titre = $langs->trans("MembersListNotUpToDate"); - } elseif ($status == '0') { - $titre = $langs->trans("MembersListResiliated"); - } - } elseif ($action == 'search') { - $titre = $langs->trans("MembersListQualified"); - } - - if ($type > 0) { + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + $titre = $langs->trans("MembersList"); + if ($status != '') + { + if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); } + elseif ($status == '-1') { $titre = $langs->trans("MembersListToValid"); } + elseif ($status == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); } + elseif ($status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); } + elseif ($status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } + elseif ($status == '0') { $titre = $langs->trans("MembersListResiliated"); } + } + elseif ($action == 'search') + { + $titre = $langs->trans("MembersListQualified"); + } + + if ($type > 0) + { $membertype = new AdherentType($db); - $result = $membertype->fetch($type); + $result = $membertype->fetch($type); $titre .= " (".$membertype->label.")"; - } - - $param = "&rowid=".$object->id; - if (!empty($status)) $param .= "&status=".$status; - if (!empty($search_lastname)) $param .= "&search_lastname=".$search_lastname; - if (!empty($search_firstname)) $param .= "&search_firstname=".$search_firstname; - if (!empty($search_login)) $param .= "&search_login=".$search_login; - if (!empty($search_email)) $param .= "&search_email=".$search_email; - if (!empty($filter)) $param .= "&filter=".$filter; - - if ($sall) { - print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; - } + } + + $param = "&rowid=".$object->id; + if (!empty($status)) $param .= "&status=".$status; + if (!empty($search_lastname)) $param .= "&search_lastname=".$search_lastname; + if (!empty($search_firstname)) $param .= "&search_firstname=".$search_firstname; + if (!empty($search_login)) $param .= "&search_login=".$search_login; + if (!empty($search_email)) $param .= "&search_email=".$search_email; + if (!empty($filter)) $param .= "&filter=".$filter; + + if ($sall) + { + print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; + } print '
'; - print ''; + print ''; print ''; print '
'; - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); - - $moreforfilter = ''; - - print '
'; - print ''."\n"; - - // Fields title search + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); + + $moreforfilter = ''; + + print '
'; + print '
'."\n"; + + // Fields title search print ''; print ''; print "\n"; print ''; - print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); - print "\n"; - - while ($i < $num && $i < $conf->liste_limit) { - $objp = $db->fetch_object($resql); - - $datefin = $db->jdate($objp->datefin); - - $adh = new Adherent($db); - $adh->lastname = $objp->lastname; - $adh->firstname = $objp->firstname; - $adh->datefin = $datefin; - $adh->need_subscription = $objp->subscription; - $adh->statut = $objp->status; - - // Lastname - print ''; - if ($objp->company != '') { - print ''."\n"; - } else { - print ''."\n"; - } - - // Login - print "\n"; - - // Type - /*print '\n"; + + while ($i < $num && $i < $conf->liste_limit) + { + $objp = $db->fetch_object($resql); + + $datefin = $db->jdate($objp->datefin); + + $adh = new Adherent($db); + $adh->lastname = $objp->lastname; + $adh->firstname = $objp->firstname; + + // Lastname + print ''; + if ($objp->company != '') + { + print ''."\n"; + } + else + { + print ''."\n"; + } + + // Login + print "\n"; + + // Type + /*print ''; */ - // Moral/Physique - print "\n"; - - // EMail - print "\n"; - - // Status - print '\n"; + + // EMail + print "\n"; + + // Statut + print '"; + + // Date end subscription + if ($datefin) + { + print ''; + } + else + { + print ''; + } + + // Actions + print '"; - // Date end subscription - if ($datefin) { - print ''; - } else { - print ''; - } - - // Actions - print '"; - - print "\n"; - $i++; + print "\n"; + $i++; + } + + print "
'; @@ -591,107 +633,123 @@ print ''; print ''; - print '  '; - print ''; + print '  '; + print ''; print '
'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).''.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 32).'".$objp->login."'; + print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); + print "
'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).''.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'".$objp->login."'; $membertypestatic->id=$objp->type_id; $membertypestatic->label=$objp->type; print $membertypestatic->getNomUrl(1,12); print '".$adh->getmorphylib($objp->morphy)."".dol_print_email($objp->email, 0, 0, 1)."'; - print $adh->getLibStatut(2); + // Moral/Physique + print "".$adh->getmorphylib($objp->morphy)."".dol_print_email($objp->email, 0, 0, 1)."'; + print $adh->LibStatut($objp->statut, $objp->subscription, $datefin, 2); + print "'; + if ($datefin < dol_now() && $objp->statut > 0) + { + print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); + } + else + { + print dol_print_date($datefin, 'day'); + } + print ''; + if ($objp->subscription == 'yes') + { + print $langs->trans("SubscriptionNotReceived"); + if ($objp->statut > 0) print " ".img_warning(); + } + else + { + print ' '; + } + print ''; + if ($user->rights->adherent->creer) + { + print ''.img_edit().''; + } + print ' '; + if ($user->rights->adherent->supprimer) + { + print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; + } print "'; - if ($datefin < dol_now() && $objp->status > 0) { - print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); - } else { - print dol_print_date($datefin, 'day'); - } - print ''; - if ($objp->subscription == 'yes') { - print $langs->trans("SubscriptionNotReceived"); - if ($objp->status > 0) print " ".img_warning(); - } else { - print ' '; - } - print ''; - if ($user->rights->adherent->creer) { - print ''.img_edit().''; - } - if ($user->rights->adherent->supprimer) { - print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; - } - print "
\n"; + print '
'; + print '
'; + + if ($num > $conf->liste_limit) + { + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); } - - print "\n"; - print ''; - print ''; - - if ($num > $conf->liste_limit) { - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); - } - } else { - dol_print_error($db); + } + else + { + dol_print_error($db); } } @@ -701,7 +759,8 @@ /* */ /* ************************************************************************** */ - if ($action == 'edit') { + if ($action == 'edit') + { $object = new AdherentType($db); $object->fetch($rowid); $object->fetch_optionals(); @@ -713,27 +772,27 @@ print ''; print ''; - print dol_get_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); + dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); print ''; print ''; - print ''; + print ''; print ''; - - // Morphy - $morphys[""] = $langs->trans("MorAndPhy"); - $morphys["phy"] = $langs->trans("Physical"); - $morphys["mor"] = $langs->trans("Moral"); - print '"; - - print ''; + + // Morphy + $morphys[""] = $langs->trans("MorPhy"); + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Moral"); + print '"; + + print ''; @@ -743,7 +802,7 @@ print ''; print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status); - print '
'.$langs->trans("MembersNature").''; - print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : $object->morphy); - print "
'.$langs->trans("SubscriptionRequired").''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->statut); + print '
'.$langs->trans("MemberNature").''; + print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy); + print "
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription", $object->subscription, 1); print '
'.$langs->trans("Duration").''; print ' '; - print $formproduct->selectMeasuringUnits("duration_unit", "time", ($object->duration_unit === '' ? 'y' : $object->duration_unit), 0, 1); + print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); print '
'.$langs->trans("Description").''; @@ -762,12 +821,12 @@ print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; - print ''; + print ''; print '     '; - print ''; + print ''; print '
'; print ""; --- /tmp/dsg/dolibarr/htdocs/adherents/github_type_ldap.php +++ /tmp/dsg/dolibarr/htdocs/adherents/client_type_ldap.php @@ -33,7 +33,7 @@ $langs->loadLangs(array("admin", "members", "ldap")); $id = GETPOST('rowid', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); // Security check $result = restrictedArea($user, 'adherent', $id, 'adherent_type'); @@ -53,12 +53,15 @@ $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 ($action == 'dolibarr2ldap') { +if (empty($reshook)) +{ + if ($action == 'dolibarr2ldap') + { $ldap = new Ldap(); $result = $ldap->connect_bind(); - if ($result > 0) { + if ($result > 0) + { $object->listMembersForMemberType('', 1); $info = $object->_load_ldap_info(); @@ -70,7 +73,8 @@ if ($result >= 0) { setEventMessages($langs->trans("MemberTypeSynchronized"), null, 'mesgs'); - } else { + } + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } } @@ -86,7 +90,7 @@ $head = member_type_prepare_head($object); -print dol_get_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group'); +dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group'); $linkback = ''.$langs->trans("BackToList").''; @@ -114,7 +118,7 @@ print ''; -print dol_get_fiche_end(); +dol_fiche_end(); /* * Action bar @@ -122,8 +126,9 @@ print '
'; -if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) { - print ''.$langs->trans("ForceSynchronize").''; +if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) +{ + print ''.$langs->trans("ForceSynchronize").''; } print "
\n"; @@ -145,29 +150,38 @@ // LDAP reading $ldap = new Ldap(); $result = $ldap->connect_bind(); -if ($result > 0) { - $info = $object->_load_ldap_info(); - $dn = $object->_load_ldap_dn($info, 1); - $search = "(".$object->_load_ldap_dn($info, 2).")"; +if ($result > 0) +{ + $info = $object->_load_ldap_info(); + $dn = $object->_load_ldap_dn($info, 1); + $search = "(".$object->_load_ldap_dn($info, 2).")"; - $records = $ldap->getAttribute($dn, $search); + $records = $ldap->getAttribute($dn, $search); - //print_r($records); + //print_r($records); - // Show tree - if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) { - if (!is_array($records)) { - print ''.$langs->trans("ErrorFailedToReadLDAP").''; - } else { - $result = show_ldap_content($records, 0, $records['count'], true); - } - } else { - print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; - } + // Show tree + if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) + { + if (!is_array($records)) + { + print ''.$langs->trans("ErrorFailedToReadLDAP").''; + } + else + { + $result = show_ldap_content($records, 0, $records['count'], true); + } + } + else + { + print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; + } - $ldap->unbind(); - $ldap->close(); -} else { + $ldap->unbind(); + $ldap->close(); +} +else +{ setEventMessages($ldap->error, $ldap->errors, 'errors'); } --- /tmp/dsg/dolibarr/htdocs/adherents/github_type_translation.php +++ /tmp/dsg/dolibarr/htdocs/adherents/client_type_translation.php @@ -35,9 +35,8 @@ $langs->loadLangs(array('members', 'languages')); $id = GETPOST('rowid', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); -$ref = GETPOST('ref', 'alphanohtml'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); @@ -52,80 +51,99 @@ */ // return to translation display if cancellation -if ($cancel == $langs->trans("Cancel")) { +if ($cancel == $langs->trans("Cancel")) +{ $action = ''; } -if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) { +if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) +{ $object = new AdherentType($db); $object->fetch($id); $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); } // Add translation -if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) { +if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) +{ $object = new AdherentType($db); $object->fetch($id); $current_lang = $langs->getDefaultLang(); - $forcelangprod = GETPOST("forcelangprod", 'aZ09'); - // update of object - if ($forcelangprod == $current_lang) { - $object->label = GETPOST("libelle", 'alphanohtml'); - $object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml')); - $object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml')); - } else { - $object->multilangs[$forcelangprod]["label"] = GETPOST("libelle", 'alphanohtml'); - $object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml')); - $object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml')); + if ($_POST["forcelangprod"] == $current_lang) + { + $object->label = $_POST["libelle"]; + $object->description = dol_htmlcleanlastbr($_POST["desc"]); + $object->other = dol_htmlcleanlastbr($_POST["other"]); + } + else + { + $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; + $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); + $object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]); } // backup into database - if ($object->setMultiLangs($user) > 0) { + if ($object->setMultiLangs($user) > 0) + { $action = ''; - } else { + } + else + { $action = 'add'; setEventMessages($object->error, $object->errors, 'errors'); } } // Edit translation -if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) { +if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) +{ $object = new AdherentType($db); $object->fetch($id); $current_lang = $langs->getDefaultLang(); - foreach ($object->multilangs as $key => $value) { // saving new values in the object - if ($key == $current_lang) { - $object->label = GETPOST("libelle-".$key, 'alphanohtml'); - $object->description = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml')); - $object->other = dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml')); - } else { - $object->multilangs[$key]["label"] = GETPOST("libelle-".$key, 'alphanohtml'); - $object->multilangs[$key]["description"] = dol_htmlcleanlastbr(GETPOST("desc-".$key, 'restricthtml')); - $object->multilangs[$key]["other"] = dol_htmlcleanlastbr(GETPOST("other-".$key, 'restricthtml')); + foreach ($object->multilangs as $key => $value) // saving new values in the object + { + if ($key == $current_lang) + { + $object->label = $_POST["libelle-".$key]; + $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); + $object->other = dol_htmlcleanlastbr($_POST["other-".$key]); } - } - - if ($object->setMultiLangs($user) > 0) { + else + { + $object->multilangs[$key]["label"] = $_POST["libelle-".$key]; + $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); + $object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]); + } + } + + if ($object->setMultiLangs($user) > 0) + { $action = ''; - } else { + } + else + { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); } } // Delete translation -if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) { +if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) +{ $object = new AdherentType($db); $object->fetch($id); $langtodelete = GETPOST('langdel', 'alpha'); - if ($object->delMultiLangs($langtodelete, $user) > 0) { + if ($object->delMultiLangs($langtodelete, $user) > 0) + { $action = ''; - } else { + } + else + { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); } @@ -156,20 +174,22 @@ // Calculate $cnt_trans $cnt_trans = 0; -if (!empty($object->multilangs)) { - foreach ($object->multilangs as $key => $value) { - $cnt_trans++; - } -} - - -print dol_get_fiche_head($head, 'translation', $titre, 0, 'group'); +if (!empty($object->multilangs)) +{ + foreach ($object->multilangs as $key => $value) + { + $cnt_trans++; + } +} + + +dol_fiche_head($head, 'translation', $titre, 0, 'group'); $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'rowid', $linkback); -print dol_get_fiche_end(); +dol_fiche_end(); @@ -181,18 +201,21 @@ print "\n
\n"; -if ($action == '') { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''.$langs->trans("Add").''; - if ($cnt_trans > 0) print ''.$langs->trans("Update").''; - } +if ($action == '') +{ + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''.$langs->trans("Add").''; + if ($cnt_trans > 0) print ''.$langs->trans("Update").''; + } } print "\n
\n"; -if ($action == 'edit') { +if ($action == 'edit') +{ //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -201,14 +224,16 @@ print ''; print ''; - if (!empty($object->multilangs)) { - foreach ($object->multilangs as $key => $value) { + if (!empty($object->multilangs)) + { + foreach ($object->multilangs as $key => $value) + { $s = picto_from_langcode($key); - print '
'.($s ? $s.' ' : '').' '.$langs->trans('Language_'.$key).': '.img_delete('', 'class="valigntextbottom"')."
"; + print "
".($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"')."
"; print '
'; print ''; - print ''; + print ''; print '
'.$langs->trans('Label').'
'.$langs->trans('Label').'
'.$langs->trans('Description').''; $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%'); $doleditor->Create(); @@ -221,17 +246,21 @@ print '
'; print '
'; - print ''; + print ''; print '     '; - print ''; + print ''; print '
'; print ''; -} elseif ($action != 'add') { - if (!empty($object->multilangs)) { - foreach ($object->multilangs as $key => $value) { +} +elseif ($action != 'add') +{ + if (!empty($object->multilangs)) + { + foreach ($object->multilangs as $key => $value) + { $s = picto_from_langcode($key); - print ($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; + print ($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; print '
'; print '
'; @@ -251,7 +280,8 @@ * Form to add a new translation */ -if ($action == 'add' && $user->rights->adherent->configurer) { +if ($action == 'add' && $user->rights->adherent->configurer) +{ //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -261,13 +291,13 @@ print ''; print ''; - print dol_get_fiche_head(); + dol_fiche_head(); print ''; print ''; - print ''; + print ''; print '
'.$langs->trans('Language').''; - print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); + print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); print '
'.$langs->trans('Label').'
'.$langs->trans('Label').'
'.$langs->trans('Description').''; $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%'); $doleditor->Create(); @@ -275,12 +305,12 @@ print '
'; - print dol_get_fiche_end(); + dol_fiche_end(); print '
'; - print ''; + print ''; print '     '; - print ''; + print ''; print '
'; print '';