public function save(Adherent $data) { if ($data->isValid()) { $this->add($data); } else { throw new RunTimeException('an adherent must be valid to be registerd, please check data and pull request again.'); } }
/** * Get object * * @param int $id Object id * @return object Object loaded */ function getObject($id) { $ret = $this->getInstanceDao(); if (is_object($this->object) && method_exists($this->object, 'fetch')) { if (!empty($id)) { $this->object->fetch($id); } } else { $object = new Adherent($this->db); if (!empty($id)) { $object->fetch($id); } $this->object = $object; } }
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @return void */ function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); $this->max = $max; include_once DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php"; $memberstatic = new Adherent($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers", $max)); if ($user->rights->societe->lire) { $sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,"; $sql .= " t.cotisation"; $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a, " . MAIN_DB_PREFIX . "adherent_type as t"; $sql .= " WHERE a.entity = " . $conf->entity; $sql .= " AND a.fk_adherent_type = t.rowid"; $sql .= " ORDER BY a.tms DESC"; $sql .= $db->plimit($max, 0); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $datec = $db->jdate($objp->datec); $datem = $db->jdate($objp->tms); $memberstatic->lastname = $objp->lastname; $memberstatic->firstname = $objp->firstname; $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT . "/adherents/fiche.php?rowid=" . $objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $memberstatic->getFullName($langs), 'url' => DOL_URL_ROOT . "/adherents/fiche.php?rowid=" . $objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => dol_print_date($datem, "day")); $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', 'text' => $memberstatic->LibStatut($objp->status, $objp->cotisation, $db->jdate($objp->date_end_subscription), 3)); $i++; } if ($num == 0) { $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoRecordedCustomers")); } } else { $this->info_box_contents[0][0] = array('td' => 'align="left"', 'maxlength' => 500, 'text' => $db->error() . ' sql=' . $sql); } } else { $this->info_box_contents[0][0] = array('align' => 'left', 'text' => $langs->trans("ReadPermissionNotAllowed")); } }
/** * Constructor * * @param DoliDB $db Database handler */ function __construct($db) { parent::__construct($db); try { $this->couchdb->useDatabase('adherent'); $fk_extrafields = new ExtraFields($db); $fk_extrafields->useDatabase('adherent'); $this->fk_extrafields = $fk_extrafields->load("extrafields:" . get_class($this), true); // load and cache } catch (Exception $e) { dol_print_error('', $e->getMessage()); exit; } return 1; }
else { print $langs->trans("NoParentCompany"); } print '</td></tr>'; } // Sales representative include(DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'); // Module Adherent if ($conf->adherent->enabled) { $langs->load("members"); print '<tr><td width="25%" valign="top">'.$langs->trans("LinkedToDolibarrMember").'</td>'; print '<td colspan="3">'; $adh=new Adherent($db); $result=$adh->fetch('','',$object->id); if ($result > 0) { $adh->ref=$adh->getFullName($langs); print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '</td>'; print "</tr>\n"; } print '</table>';
} } if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) { $accline = new AccountLine($db); $result = $accline->fetch(GETPOST("rowid")); $result = $accline->delete(); } /* * View */ llxHeader('', $langs->trans("FinancialAccount") . '-' . $langs->trans("Transactions")); $societestatic = new Societe($db); $userstatic = new User($db); $chargestatic = new ChargeSociales($db); $loanstatic = new Loan($db); $memberstatic = new Adherent($db); $paymentstatic = new Paiement($db); $paymentsupplierstatic = new PaiementFourn($db); $paymentvatstatic = new TVA($db); $paymentsalstatic = new PaymentSalary($db); $donstatic = new Don($db); $expensereportstatic = new ExpenseReport($db); $bankstatic = new Account($db); $banklinestatic = new AccountLine($db); $form = new Form($db); if ($id > 0 || !empty($ref)) { if ($vline) { $viewline = $vline; } else { $viewline = empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? 20 : $conf->global->MAIN_SIZE_LISTE_LIMIT; }
$mode = GETPOST('mode') ? GETPOST('mode') : ''; // Security check if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $year = strftime("%Y", time()); $startyear = $year - 2; $endyear = $year; $langs->load("members"); $langs->load("companies"); /* * View */ $memberstatic = new Adherent($db); llxHeader('', '', '', '', 0, 0, array('http://www.google.com/jsapi')); $title = $langs->trans("MembersStatisticsByProperties"); print load_fiche_titre($title, $mesg); dol_mkdir($dir); $tab = 'byproperties'; $data = array(); $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code"; $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d"; $sql .= " WHERE d.entity IN (" . getEntity() . ")"; $sql .= " AND d.statut = 1"; $sql .= " GROUP BY d.morphy"; $foundphy = $foundmor = 0; // Define $data array dol_syslog("Count member", LOG_DEBUG); $resql = $db->query($sql);
$langs->load("members"); $langs->load("errors"); // Choix de l'annee d'impression ou annee courante. $now = dol_now(); $year = dol_print_date($now, '%Y'); $month = dol_print_date($now, '%m'); $day = dol_print_date($now, '%d'); $foruserid = GETPOST('foruserid'); $foruserlogin = GETPOST('foruserlogin'); $mode = GETPOST('mode'); $model = GETPOST("model"); // Doc template to use for business cards $modellabel = GETPOST("modellabel"); // Doc template to use for address sheet $mesg = ''; $adherentstatic = new Adherent($db); /* * Actions */ if ($mode == 'cardlogin' && empty($foruserlogin)) { $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")); } if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) { $arrayofmembers = array(); // requete en prenant que les adherents a jour de cotisation $sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,"; $sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,"; $sql .= " t.libelle as type,"; $sql .= " c.code as country_code, c.label as country"; $sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t, " . MAIN_DB_PREFIX . "adherent as d"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON d.country = c.rowid";
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print ' '; print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; print "</tr>\n"; print '</form>'; $var=True; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($resql); $datefin=$db->jdate($objp->datefin); $adh=new Adherent($db); // Nom $var=!$var; print "<tr $bc[$var]>"; if ($objp->societe != '') { print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom,12)." / ".dol_trunc($objp->societe,12)."</a></td>\n"; } else { print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom)."</a></td>\n"; } // Login print "<td>".$objp->login."</td>\n";
/** * \file htdocs/adherents/agenda.php * \ingroup member * \brief Page of members events */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php'; $langs->load("companies"); $langs->load("members"); $id = GETPOST('id', 'int'); // Security check $result = restrictedArea($user, 'adherent', $id); $object = new Adherent($db); $result = $object->fetch($id); if ($result > 0) { $object->fetch_thirdparty(); $adht = new AdherentType($db); $result = $adht->fetch($object->typeid); } /* * Actions */ // None /* * View */ $contactstatic = new Contact($db); $form = new Form($db);
print '</form>'; /* * Test de la connexion */ if (!empty($conf->global->LDAP_MEMBER_ACTIVE)) { $butlabel = $langs->trans("LDAPTestSynchroMember"); $testlabel = 'testmember'; $key = $conf->global->LDAP_KEY_MEMBERS; $dn = $conf->global->LDAP_MEMBER_DN; $objectclass = $conf->global->LDAP_MEMBER_OBJECT_CLASS; show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass); } if (function_exists("ldap_connect")) { if ($_GET["action"] == 'testmember') { // Creation objet $object = new Adherent($db); $object->initAsSpecimen(); // Test synchro $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result > 0) { $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); $result1 = $ldap->delete($dn); // To be sure to delete existing records $result2 = $ldap->add($dn, $info, $user); // Now the test $result3 = $ldap->delete($dn); // Clean what we did if ($result2 > 0) { print img_picto('', 'info') . ' ';
include_once "C:\\wamp\\www\\CMPJ\\Controleurs\\HTTPRequest.php"; include_once "C:\\wamp\\www\\CMPJ\\Controleurs\\HTTPResponse.php"; include_once "C:\\wamp\\www\\CMPJ\\Model\\AdherentManagerPDO.php"; include_once "C:\\wamp\\www\\CMPJ\\Model\\PDOFactory.php"; $request = new HTTPRequest(); $manager = new AdherentManagerPDO(PDOFactory::getPdoInstance()); if (isset($_GET['modifier'])) { if (!$manager->Exists((int) $_GET['modifier'])) { $message = 'NOT FOUND.'; } else { $adherent = $manager->getUnique((int) $_GET['modifier']); } } if ($request->postExists('nom')) { //on hydrate les données $adherent = new Adherent(['nom' => $request->postData('nom'), 'prenom' => $request->postData('prenom'), 'dateNaissance' => $request->postData('date'), 'lieu' => $request->postData('lieuNaissance'), 'sexe' => $request->postData('sexe'), 'region' => $request->postData('region'), 'departement' => $request->postData('departement'), 'ethnie' => $request->postData('ethnie'), 'nationalite' => $request->postData('nationalite'), 'profession_mere_parrain' => $request->postData('profession'), 'situationMatrimoniale' => $request->postData('situation'), 'lieuResidence' => $request->postData('lieuResidence'), 'adresse' => $request->postData('addr'), 'telPerso' => $request->postData('telPerso'), 'sosTel' => $request->postData('sosTel'), 'sosName' => $request->postData('sosName'), 'diplomeEleve' => $request->postData('diplome'), 'dateObtentionPlace' => $request->postData('dateObtention'), 'speakLanguage' => $request->postData('speakLanguage'), 'filiere' => $request->postData('option')]); $adherent->setId((int) $_GET['modifier']); if ($adherent->isvalid()) { $manager->update($adherent); $message = 'Informations bien modifiées '; } else { $erreurs = $adherent->getErreurs(); } } ?> <!DOCTYPE html> <html> <head> <title>Formulaire d'inscription CMPJ MAYO-LOUTI</title> <meta charset="utf-8" content="text/html"> <link rel="stylesheet" href="css/Envision.css" >
print $langs->trans("ThisUserIsNot"); } print ' ('.$langs->trans("UseTypeFieldToChange").')'; print '</td>'; print "</tr>\n"; } // Module Adherent if (! empty($conf->adherent->enabled)) { $langs->load("members"); print '<tr><td width="25%">'.$langs->trans("LinkedToDolibarrMember").'</td>'; print '<td>'; if ($object->fk_member) { $adh=new Adherent($db); $adh->fetch($object->fk_member); $adh->ref=$adh->login; // Force to show login instead of id print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '</td>'; print "</tr>\n"; } // Multicompany // TODO check if user not linked with the current entity before change entity (thirdparty, invoice, etc.) !! if (! empty($conf->multicompany->enabled) && is_object($mc))
print $langs->trans("LDAPSynchronizationNotSetupInDolibarr"); exit(-1); } */ $sql = "SELECT rowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "adherent"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $ldap = new Ldap(); $ldap->connect_bind(); while ($i < $num) { $ldap->error = ""; $obj = $db->fetch_object($resql); $member = new Adherent($db); $result = $member->fetch($obj->rowid); if ($result < 0) { dol_print_error($db, $member->error); exit(-1); } $result = $member->fetch_subscriptions(); if ($result < 0) { dol_print_error($db, $member->error); exit(-1); } print $langs->transnoentities("UpdateMember") . " rowid=" . $member->id . " " . $member->getFullName($langs); $oldobject = $member; $oldinfo = $oldobject->_load_ldap_info(); $olddn = $oldobject->_load_ldap_dn($oldinfo); $info = $member->_load_ldap_info();
require_once DOL_DOCUMENT_ROOT . '/core/lib/ldap.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/ldap.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php'; $langs->load("companies"); $langs->load("members"); $langs->load("ldap"); $langs->load("admin"); $rowid = GETPOST('id', 'int'); $action = GETPOST('action'); // Protection $socid = 0; if ($user->societe_id > 0) { $socid = $user->societe_id; } $adh = new Adherent($db); $adh->id = $rowid; $result = $adh->fetch($rowid); if (!$result) { dol_print_error($db, "Failed to get adherent: " . $adh->error); exit; } /* * Actions */ if ($action == 'dolibarr2ldap') { $db->begin(); $ldap = new Ldap(); $result = $ldap->connect_bind(); $info = $adh->_load_ldap_info(); $dn = $adh->_load_ldap_dn($info);
$_POST['action'] = ''; $action = ''; } } } if ($action == 'setsocid') { $error = 0; if (!$error) { if (GETPOST('socid', 'int') != $object->fk_soc) { $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent"; $sql .= " WHERE fk_soc = '" . GETPOST('socid', 'int') . "'"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj && $obj->rowid > 0) { $othermember = new Adherent($db); $othermember->fetch($obj->rowid); $thirdparty = new Societe($db); $thirdparty->fetch(GETPOST('socid', 'int')); $error++; setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors'); } } if (!$error) { $result = $object->setThirdPartyId(GETPOST('socid', 'int')); if ($result < 0) { dol_print_error('', $object->error); } $_POST['action'] = ''; $action = ''; }
print '<td class="liste_titre"> </td>'; print '<td class="liste_titre" align="left">'; print '<input class="flat" type="text" name="search_email" value="' . dol_escape_htmltag($search_email) . '" size="12"></td>'; print '<td class="liste_titre"> </td>'; print '<td align="right" colspan="2" class="liste_titre">'; print '<input type="image" class="liste_titre" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print ' '; print '<input type="image" class="liste_titre" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/searchclear.png" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; print '</td>'; print "</tr>\n"; print '</form>'; $var = True; 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 $var = !$var; print '<tr ' . $bc[$var] . '>'; if ($objp->societe != '') { print '<td><a href="card.php?rowid=' . $objp->rowid . '">' . img_object($langs->trans("ShowMember"), "user") . ' ' . $adh->getFullName($langs, 0, -1, 20) . ' / ' . dol_trunc($objp->societe, 12) . '</a></td>' . "\n"; } else { print '<td><a href="card.php?rowid=' . $objp->rowid . '">' . img_object($langs->trans("ShowMember"), "user") . ' ' . $adh->getFullName($langs, 0, -1, 32) . '</a></td>' . "\n"; } // Login print "<td>" . $objp->login . "</td>\n"; // Type /*print '<td class="nowrap">'; $membertypestatic->id=$objp->type_id;
/** * \file htdocs/adherents/cotisations.php * \ingroup member * \brief Page de consultation et insertion d'une cotisation */ require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT . "/adherent/class/adherent.class.php"; require_once DOL_DOCUMENT_ROOT . "/compta/bank/class/account.class.php"; $langs->load("members"); $msg = ''; $date_select = GETPOST("date_select"); if (!$user->rights->adherent->cotisation->lire) { accessforbidden(); } // Static objects $adherent = new Adherent($db); $accountstatic = new Account($db); /* * Actions */ /* * View */ llxHeader('', $langs->trans("ListOfSubscriptions"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); if ($msg) { print $msg . '<br>'; } if (!empty($date_select)) { $result = $adherent->getView('cotisationYear', array("key" => (int) $date_select)); } else { $result = $adherent->getView('cotisationYear');
$email=$contract->client->email; $email=(GETPOST("email")?GETPOST("email"):(isValidEmail($email)?$email:'')); print '</td><td class="CTableRow'.($var?'1':'2').'"><input class="flat" type="text" name="email" size="48" value="'.$email.'"></td></tr>'."\n"; } // Payment on member subscription if (GETPOST("source") == 'membersubscription') { $found=true; $langs->load("members"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php"); $member=new Adherent($db); $result=$member->fetch('',GETPOST("ref")); if ($result < 0) { $mesg=$member->error; $error++; } else { $subscription=new Cotisation($db); } $amount=$subscription->total_ttc; if (GETPOST("amount",'int')) $amount=GETPOST("amount",'int'); $amount=price2num($amount);
} else { dol_print_error($db); exit(-1); } $ldap = new Ldap(); $result = $ldap->connect_bind(); if ($result >= 0) { $justthese = array(); // We disable synchro Dolibarr-LDAP $conf->global->LDAP_MEMBER_ACTIVE = 0; $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_MEMBER_DN, $conf->global->LDAP_KEY_MEMBERS, $required_fields, 0); if (is_array($ldaprecords)) { $db->begin(); // Warning $ldapuser has a key in lowercase foreach ($ldaprecords as $key => $ldapuser) { $member = new Adherent($db); // Propriete membre $member->firstname = $ldapuser[$conf->global->LDAP_FIELD_FIRSTNAME]; $member->lastname = $ldapuser[$conf->global->LDAP_FIELD_NAME]; $member->login = $ldapuser[$conf->global->LDAP_FIELD_LOGIN]; $member->pass = $ldapuser[$conf->global->LDAP_FIELD_PASSWORD]; //$member->societe; $member->address = $ldapuser[$conf->global->LDAP_FIELD_ADDRESS]; $member->zip = $ldapuser[$conf->global->LDAP_FIELD_ZIP]; $member->town = $ldapuser[$conf->global->LDAP_FIELD_TOWN]; $member->country = $ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; $member->country_id = $countries[$hashlib2rowid[strtolower($member->country)]]['rowid']; $member->country_code = $countries[$hashlib2rowid[strtolower($member->country)]]['code']; $member->phone = $ldapuser[$conf->global->LDAP_FIELD_PHONE]; $member->phone_perso = $ldapuser[$conf->global->LDAP_FIELD_PHONE_PERSO]; $member->phone_mobile = $ldapuser[$conf->global->LDAP_FIELD_MOBILE];
/** * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action * @param string $id Id of object * @param string $ref Ref of object * @return void */ function assign_values(&$action, $id = 0, $ref = '') { global $conf, $langs, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; if ($action == 'add' || $action == 'update') { $this->assign_post($action); } if ($_GET["type"] == 'f') { $this->object->fournisseur = 1; } if ($_GET["type"] == 'c') { $this->object->client = 1; } if ($_GET["type"] == 'p') { $this->object->client = 2; } if ($_GET["type"] == 'cp') { $this->object->client = 3; } if ($_REQUEST["private"] == 1) { $this->object->particulier = 1; } foreach ($this->object as $key => $value) { $this->tpl[$key] = $value; } $this->tpl['error'] = get_htmloutput_errors($this->object->error, $this->object->errors); if (is_array($GLOBALS['errors'])) { $this->tpl['error'] = get_htmloutput_mesg('', $GLOBALS['errors'], 'error'); } if ($action == 'create') { if ($conf->use_javascript_ajax) { $this->tpl['ajax_selecttype'] = "\n" . '<script type="text/javascript" language="javascript"> $(document).ready(function () { $("#radiocompany").click(function() { document.formsoc.action.value="create"; document.formsoc.canvas.value="company"; document.formsoc.private.value=0; document.formsoc.submit(); }); $("#radioprivate").click(function() { document.formsoc.action.value="create"; document.formsoc.canvas.value="individual"; document.formsoc.private.value=1; document.formsoc.submit(); }); }); </script>' . "\n"; } } if ($action == 'create' || $action == 'edit') { if ($conf->use_javascript_ajax) { $this->tpl['ajax_selectcountry'] = "\n" . '<script type="text/javascript" language="javascript"> $(document).ready(function () { $("#selectcountry_id").change(function() { document.formsoc.action.value="' . $action . '"; document.formsoc.canvas.value="' . $canvas . '"; document.formsoc.submit(); }); }) </script>' . "\n"; } // Load object modCodeClient $module = !empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { $res = dol_include_once($dirroot . $module . '.php'); if ($res) { break; } } $modCodeClient = new $module($db); $this->tpl['auto_customercode'] = $modCodeClient->code_auto; // We verified if the tag prefix is used if ($modCodeClient->code_auto) { $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); } // TODO create a function $this->tpl['select_customertype'] = '<select class="flat" name="client">'; $this->tpl['select_customertype'] .= '<option value="2"' . ($this->object->client == 2 ? ' selected="selected"' : '') . '>' . $langs->trans('Prospect') . '</option>'; $this->tpl['select_customertype'] .= '<option value="3"' . ($this->object->client == 3 ? ' selected="selected"' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>'; $this->tpl['select_customertype'] .= '<option value="1"' . ($this->object->client == 1 ? ' selected="selected"' : '') . '>' . $langs->trans('Customer') . '</option>'; $this->tpl['select_customertype'] .= '<option value="0"' . ($this->object->client == 0 ? ' selected="selected"' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>'; $this->tpl['select_customertype'] .= '</select>'; // Customer $this->tpl['customercode'] = $this->object->code_client; if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) { $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0); } $this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable(); $s = $modCodeClient->getToolTip($langs, $this->object, 0); $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1); if (!empty($conf->fournisseur->enabled)) { $this->tpl['supplier_enabled'] = 1; // Load object modCodeFournisseur $module = $conf->global->SOCIETE_CODECLIENT_ADDON; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { $res = dol_include_once($dirroot . $module . '.php'); if ($res) { break; } } $modCodeFournisseur = new $module(); $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; // We verified if the tag prefix is used if ($modCodeFournisseur->code_auto) { $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); } // Supplier $this->tpl['yn_supplier'] = $form->selectyesno("fournisseur", $this->object->fournisseur, 1); $this->tpl['suppliercode'] = $this->object->code_fournisseur; if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1); } $this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable(); $s = $modCodeFournisseur->getToolTip($langs, $this->object, 1); $this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1); $this->object->LoadSupplierCateg(); $this->tpl['suppliercategory'] = $this->object->SupplierCategories; } // Zip $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); // Town $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); // Country $this->object->country_id = $this->object->country_id ? $this->object->country_id : $mysoc->country_id; $this->object->country_code = $this->object->country_code ? $this->object->country_code : $mysoc->country_code; $this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id'); $countrynotdefined = $langs->trans("ErrorSetACountryFirst") . ' (' . $langs->trans("SeeAbove") . ')'; if ($user->admin) { $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } // State if ($this->object->country_id) { $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code); } else { $this->tpl['select_state'] = $countrynotdefined; } // Language if (!empty($conf->global->MAIN_MULTILANGS)) { $this->tpl['select_lang'] = $formadmin->select_language($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, 0, 1); } // VAT $this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1); // Assujeti par defaut en creation // Select users $this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1); // Local Tax // TODO mettre dans une classe propre au pays if ($mysoc->country_code == 'ES') { $this->tpl['localtax'] = ''; if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td>'; $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td>'; $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td></tr>'; } elseif ($mysoc->localtax1_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td><td colspan="3">'; $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td><tr>'; } elseif ($mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td><td colspan="3">'; $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '</td><tr>'; } } } else { $head = societe_prepare_head($this->object); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company'); $this->tpl['showend'] = dol_get_fiche_end(); $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', $user->societe_id ? 0 : 1, 'rowid', 'nom'); $this->tpl['checkcustomercode'] = $this->object->check_codeclient(); $this->tpl['checksuppliercode'] = $this->object->check_codefournisseur(); $this->tpl['address'] = dol_nl2br($this->object->address); $img = picto_from_langcode($this->object->country_code); if ($this->object->isInEEC()) { $this->tpl['country'] = $form->textwithpicto(($img ? $img . ' ' : '') . $this->object->country, $langs->trans("CountryIsInEEC"), 1, 0); } $this->tpl['country'] = ($img ? $img . ' ' : '') . $this->object->country; $this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL'); $this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX'); $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL'); $this->tpl['url'] = dol_print_url($this->object->url); $this->tpl['tva_assuj'] = yn($this->object->tva_assuj); // Third party type $arr = $formcompany->typent_array(1); $this->tpl['typent'] = $arr[$this->object->typent_code]; if (!empty($conf->global->MAIN_MULTILANGS)) { require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; //$s=picto_from_langcode($this->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); $this->tpl['default_lang'] = $this->default_lang ? $langs->trans('Language_' . $this->object->default_lang) : ''; } $this->tpl['image_edit'] = img_edit(); $this->tpl['display_rib'] = $this->object->display_rib(); // Sales representatives $this->tpl['sales_representatives'] = ''; $listsalesrepresentatives = $this->object->getSalesRepresentatives($user); $nbofsalesrepresentative = count($listsalesrepresentatives); if ($nbofsalesrepresentative > 3) { $this->tpl['sales_representatives'] .= '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $this->object->id . '">'; $this->tpl['sales_representatives'] .= $nbofsalesrepresentative; $this->tpl['sales_representatives'] .= '</a>'; } else { if ($nbofsalesrepresentative > 0) { $userstatic = new User($this->db); $i = 0; foreach ($listsalesrepresentatives as $val) { $userstatic->id = $val['id']; $userstatic->lastname = $val['name']; $userstatic->firstname = $val['firstname']; $this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1); $i++; if ($i < $nbofsalesrepresentative) { $this->tpl['sales_representatives'] .= ', '; } } } else { $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected"); } } // Linked member if (!empty($conf->adherent->enabled)) { $langs->load("members"); $adh = new Adherent($this->db); $result = $adh->fetch('', '', $this->object->id); if ($result > 0) { $adh->ref = $adh->getFullName($langs); $this->tpl['linked_member'] = $adh->getNomUrl(1); } else { $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember"); } } // Local Tax // TODO mettre dans une classe propre au pays if ($mysoc->country_code == 'ES') { $this->tpl['localtax'] = ''; if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax1_assuj) . '</td>'; $this->tpl['localtax'] .= '<td>' . $langs->trans("LocalTax2IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td>' . yn($this->object->localtax2_assuj) . '</td></tr>'; } elseif ($mysoc->localtax1_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax1IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax1_assuj) . '</td></tr>'; } elseif ($mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= '<tr><td>' . $langs->trans("LocalTax2IsUsedES") . '</td>'; $this->tpl['localtax'] .= '<td colspan="3">' . yn($this->object->localtax2_assuj) . '</td></tr>'; } } } }
$page = GETPOST("page", 'int'); if ($page == -1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortorder) { $sortorder = "ASC"; } if (!$sortfield) { $sortfield = "name"; } $upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id, 2, 0, 1) . '/' . $id; $form = new Form($db); $object = new Adherent($db); $membert = new AdherentType($db); $result = $object->fetch($id); if ($result < 0) { dol_print_error($db); exit; } /* * Actions */ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; /* * View */ llxHeader(); if ($id > 0) {
print '<input type="hidden" name="shipToZip" value="' . $shipToZip . '">' . "\n"; print '<input type="hidden" name="shipToStreet2" value="' . $shipToStreet2 . '">' . "\n"; print '<input type="hidden" name="phoneNum" value="' . $phoneNum . '">' . "\n"; } else { print '<!-- Shipping address not complete, so we don t use it -->' . "\n"; } print '<input type="hidden" name="email" value="' . $contract->thirdparty->email . '">' . "\n"; print '<input type="hidden" name="desc" value="' . $langs->trans("Contract") . ' ' . $contract->ref . '">' . "\n"; } // Payment on member subscription if (GETPOST("source") == 'membersubscription' && $valid) { $found = true; $langs->load("members"); require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php'; $member = new Adherent($db); $result = $member->fetch('', $ref); if ($result < 0) { $mesg = $member->error; $error++; } else { $subscription = new Cotisation($db); } $amount = $subscription->total_ttc; if (GETPOST("amount", 'int')) { $amount = GETPOST("amount", 'int'); } $amount = price2num($amount); $fulltag = 'MEM=' . $member->id . '.DAT=' . dol_print_date(dol_now(), '%Y%m%d%H%M'); if (!empty($TAG)) { $tag = $TAG;
while ($i < min($num, $conf->liste_limit)) { $obj = $db->fetch_object($resql); $var = !$var; print "<tr " . $bc[$var] . ">"; print '<td>' . $obj->email . '</td>'; print '<td>' . $obj->lastname . '</td>'; print '<td>' . $obj->firstname . '</td>'; print '<td>' . $obj->other . '</td>'; print '<td align="center">'; if (empty($obj->source_id) || empty($obj->source_type)) { print $obj->source_url; // For backward compatibility } else { if ($obj->source_type == 'member') { include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $objectstatic = new Adherent($db); $objectstatic->fetch($obj->source_id); print $objectstatic->getNomUrl(2); } else { if ($obj->source_type == 'user') { include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; $objectstatic = new User($db); $objectstatic->fetch($obj->source_id); $objectstatic->id = $obj->source_id; print $objectstatic->getNomUrl(2); } else { if ($obj->source_type == 'thirdparty') { include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; $objectstatic = new Societe($db); $objectstatic->fetch($obj->source_id); print $objectstatic->getNomUrl(2);
/** * Delete a subscription * * @param User $user User that delete * @return int <0 if KO, 0 if not found, >0 if OK */ function delete($user) { // It subscription is linked to a bank transaction, we get it if ($this->fk_bank) { require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; $accountline = new AccountLine($this->db); $result = $accountline->fetch($this->fk_bank); } $this->db->begin(); $sql = "DELETE FROM " . MAIN_DB_PREFIX . "cotisation WHERE rowid = " . $this->id; dol_syslog(get_class($this) . "::delete sql=" . $sql); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->affected_rows($resql); if ($num) { require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $member = new Adherent($this->db); $result = $member->fetch($this->fk_adherent); $result = $member->update_end_date($user); if ($accountline->rowid > 0) { $result = $accountline->delete($user); // Return false if refused because line is conciliated if ($result > 0) { $this->db->commit(); return 1; } else { $this->error = $accountline->error; $this->db->rollback(); return -1; } } else { $this->db->commit(); return 1; } } else { $this->db->commit(); return 0; } } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } }
$_POST['action'] = ''; $action = ''; } } } if ($action == 'setsocid') { $error = 0; if (!$error) { if (GETPOST('socid', 'int') != $object->fk_soc) { $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent"; $sql .= " WHERE fk_soc = '" . GETPOST('socid', 'int') . "'"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj && $obj->rowid > 0) { $othermember = new Adherent($db); $othermember->fetch($obj->rowid); $thirdparty = new Societe($db); $thirdparty->fetch(GETPOST('socid', 'int')); $error++; $mesg = '<div class="error">' . $langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name) . '</div>'; } } if (!$error) { $result = $object->setThirdPartyId(GETPOST('socid', 'int')); if ($result < 0) { dol_print_error('', $object->error); } $_POST['action'] = ''; $action = ''; }
$result = $tmpobject->fetch($removeelem); $elementtype = 'product'; } else { if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'fournisseur'; } else { if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'societe'; } else { if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; } else { if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'contact'; } } } } } $result = $object->del_type($tmpobject, $elementtype); if ($result < 0) {
$contact->fetch($fuser->contact_id); print ' / <a href="' . DOL_URL_ROOT . '/contact/fiche.php?id=' . $fuser->contact_id . '">' . img_object($langs->trans("ShowContact"), 'contact') . ' ' . dol_trunc($contact->getFullName($langs), 32) . '</a>'; } } else { print $langs->trans("ThisUserIsNot"); } print '</td>'; print "</tr>\n"; } // Module Adherent if ($conf->adherent->enabled) { $langs->load("members"); print '<tr><td width="25%" valign="top">' . $langs->trans("LinkedToDolibarrMember") . '</td>'; print '<td>'; if ($fuser->fk_member) { $adh = new Adherent($db); $adh->fetch($fuser->fk_member); $adh->ref = $adh->login; // Force to show login instead of id print $adh->getNomUrl(1); } else { print $langs->trans("UserNotLinkedToMember"); } print '</td>'; print "</tr>\n"; } print '</table>'; print '<br><center>'; print '<input value="' . $langs->trans("Save") . '" class="button" type="submit" name="save">'; print ' '; print '<input value="' . $langs->trans("Cancel") . '" class="button" type="submit" name="cancel">';
* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * \file htdocs/adherents/index.php * \ingroup member * \brief Page accueil module adherents */ require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT . "/adherent/class/adherent.class.php"; $langs->load("companies"); $langs->load("members"); /* * View */ llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); $staticmember = new Adherent($db); print_fiche_titre($langs->trans("MembersArea")); print '<table border="0" width="100%" class="notopnoleftnoright">'; $var = True; $Adherents = array(); $AdherentsAValider = array(); $MemberUpToDate = array(); $AdherentsResilies = array(); $AdherentType = array(); $result = $staticmember->getView('tag', array("group" => true)); if (count($result->rows)) { foreach ($result->rows as $aRow) { $AdherentType[$aRow->key] = $aRow->value; } } $now = dol_now();
print '</table></form>'; print '<br>'; // Contacts lines (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl')); foreach ($dirtpls as $reldir) { $res = @(include dol_buildpath($reldir . '/contacts.tpl.php')); if ($res) { break; } } // additionnal list with adherents of company if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) { require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php'; $membertypestatic = new AdherentType($db); $memberstatic = new Adherent($db); $langs->load("members"); $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; $sql .= " d.datefin,"; $sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,"; $sql .= " t.libelle as type, t.cotisation"; $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d"; $sql .= ", " . MAIN_DB_PREFIX . "adherent_type as t"; $sql .= " WHERE d.fk_soc=" . $id; dol_syslog("get list sql=" . $sql); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); if ($num > 0) { $titre = $langs->trans("MembersListOfTiers"); print '<br>';