31 require
'../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
42 $langs->loadLangs(array(
"companies",
"bills",
"members",
"users",
"mails",
'other'));
44 $action =
GETPOST(
'action',
'aZ09');
45 $confirm =
GETPOST(
'confirm',
'alpha');
46 $contextpage =
GETPOST(
'contextpage',
'aZ09');
47 $optioncss =
GETPOST(
'optioncss',
'aZ');
51 $ref =
GETPOST(
'ref',
'alphanohtml');
52 $typeid =
GETPOST(
'typeid',
'int');
56 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
57 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60 if (empty($page) || $page == -1) {
63 $offset = $limit * $page;
64 $pageprev = $page - 1;
65 $pagenext = $page + 1;
69 $sortfield =
"c.rowid";
80 $extrafields->fetch_name_optionals_label($object->table_element);
85 $hookmanager->initHooks(array(
'subscription'));
88 $hidedetails = (
GETPOST(
'hidedetails',
'int') ?
GETPOST(
'hidedetails',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
89 $hidedesc = (
GETPOST(
'hidedesc',
'int') ?
GETPOST(
'hidedesc',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
90 $hideref = (
GETPOST(
'hideref',
'int') ?
GETPOST(
'hideref',
'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
97 if ($id > 0 || !empty($ref)) {
99 $result = $object->fetch($id, $ref);
102 $canadduser = ($user->admin || $user->hasRight(
"user",
"user",
"creer"));
104 if ($object->user_id) {
106 $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight(
"user",
"self",
"creer"))
107 || (($user->id != $object->user_id) && $user->hasRight(
"user",
"user",
"creer")));
108 $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight(
"user",
"self",
"password"))
109 || (($user->id != $object->user_id) && $user->hasRight(
"user",
"user",
"password")));
114 $canaddmember = $user->hasRight(
'adherent',
'creer');
117 $caneditfieldmember = $user->hasRight(
'adherent',
'creer');
121 $result =
restrictedArea($user,
'adherent', $object->id,
'',
'',
'socid',
'rowid', 0);
128 $parameters = array();
129 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
135 if (empty($reshook) && $action ==
'confirm_create_thirdparty' && $confirm ==
'yes' && $user->hasRight(
'societe',
'creer')) {
139 $result = $company->create_from_member($object,
GETPOST(
'companyname',
'alpha'),
GETPOST(
'companyalias',
'alpha'),
GETPOST(
'customercode',
'alpha'));
142 $langs->load(
"errors");
145 $action =
'addsubscription';
152 if (empty($reshook) && $action ==
'setuserid' && ($user->hasRight(
'user',
'self',
'creer') || $user->hasRight(
'user',
'user',
'creer'))) {
154 if (!$user->hasRight(
'user',
'user',
'creer')) {
155 if (
GETPOST(
"userid",
'int') != $user->id &&
GETPOST(
"userid",
'int') != $object->user_id) {
157 setEventMessages($langs->trans(
"ErrorUserPermissionAllowsToLinksToItselfOnly"),
null,
'errors');
162 if (
GETPOST(
"userid",
'int') != $object->user_id) {
163 $result = $object->setUserId(
GETPOST(
"userid",
'int'));
172 if (empty($reshook) && $action ==
'setsocid') {
175 if (
GETPOST(
'socid',
'int') != $object->fk_soc) {
176 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"adherent";
177 $sql .=
" WHERE fk_soc = '".GETPOST(
'socid',
'int').
"'";
178 $resql = $db->query(
$sql);
180 $obj = $db->fetch_object($resql);
181 if ($obj && $obj->rowid > 0) {
183 $othermember->fetch($obj->rowid);
184 $thirdparty =
new Societe($db);
185 $thirdparty->fetch(
GETPOST(
'socid',
'int'));
187 setEventMessages($langs->trans(
"ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name),
null,
'errors');
192 $result = $object->setThirdPartyId(
GETPOST(
'socid',
'int'));
202 if ($user->hasRight(
'adherent',
'cotisation',
'creer') && $action ==
'subscription' && !$cancel) {
205 $langs->load(
"banks");
207 $result = $object->fetch($rowid);
208 $result = $adht->fetch($object->typeid);
211 $datesubscription = 0;
213 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
214 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
222 if (
GETPOST(
"paymentyear",
'int') &&
GETPOST(
"paymentmonth",
'int') &&
GETPOST(
"paymentday",
'int')) {
229 $accountid =
GETPOST(
"accountid",
'int');
230 $operation =
GETPOST(
"operation",
"alphanohtml");
231 $num_chq =
GETPOST(
"num_chq",
"alphanohtml");
232 $emetteur_nom =
GETPOST(
"chqemetteur");
233 $emetteur_banque =
GETPOST(
"chqbank");
234 $option =
GETPOST(
"paymentsave");
235 if (empty($option)) {
238 $sendalsoemail =
GETPOST(
"sendmail",
'alpha');
241 if (!$datesubscription) {
243 $langs->load(
"errors");
244 $errmsg = $langs->trans(
"ErrorBadDateFormat", $langs->transnoentitiesnoconv(
"DateSubscription"));
246 $action =
'addsubscription';
248 if (
GETPOST(
'end') && !$datesubend) {
250 $langs->load(
"errors");
251 $errmsg = $langs->trans(
"ErrorBadDateFormat", $langs->transnoentitiesnoconv(
"DateEndSubscription"));
253 $action =
'addsubscription';
258 if (($option ==
'bankviainvoice' || $option ==
'bankdirect') && !$paymentdate) {
260 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DatePayment"));
262 $action =
'addsubscription';
266 if ($adht->subscription) {
267 if (!is_numeric($amount)) {
269 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount"));
272 $action =
'addsubscription';
278 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Label"));
281 $action =
'addsubscription';
283 if (
GETPOST(
"paymentsave") !=
'invoiceonly' && !
GETPOST(
"operation")) {
284 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"PaymentMode"));
287 $action =
'addsubscription';
289 if (
GETPOST(
"paymentsave") !=
'invoiceonly' && !(
GETPOST(
"accountid",
'int') > 0)) {
290 $errmsg = $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"FinancialAccount"));
293 $action =
'addsubscription';
296 if (
GETPOST(
"accountid",
'int')) {
297 $errmsg = $langs->trans(
"ErrorDoNotProvideAccountsIfNullAmount");
300 $action =
'addsubscription';
308 if (!$error && $action ==
'subscription') {
312 $crowid = $object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
315 $errmsg = $object->error;
320 $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque);
333 $action =
'addsubscription';
343 if ($object->email && $sendalsoemail) {
345 'datesubscription' => $datesubscription,
347 'ccountid' => $accountid,
348 'operation' => $operation,
350 'num_chq' => $num_chq,
351 'emetteur_nom' => $emetteur_nom,
352 'emetteur_banque' => $emetteur_banque,
353 'datesubend' => $datesubend
355 $reshook = $hookmanager->executeHooks(
'sendMail', $parameters, $object, $action);
360 if (empty($reshook)) {
365 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
369 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
371 $outputlangs->loadLangs(array(
"main",
"members"));
374 $arraydefaultmessage =
null;
375 $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
377 if (!empty($labeltouse)) {
378 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
381 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
382 $subject = $arraydefaultmessage->topic;
383 $msg = $arraydefaultmessage->content;
393 $listofpaths = array();
394 $listofnames = array();
395 $listofmimes = array();
396 if (is_object($object->invoice) && (!is_object($arraydefaultmessage) || intval($arraydefaultmessage->joinfiles))) {
397 $invoicediroutput = $conf->facture->dir_output;
398 $fileparams =
dol_most_recent_file($invoicediroutput.
'/'.$object->invoice->ref, preg_quote($object->invoice->ref,
'/').
'[^\-]+');
399 $file = $fileparams[
'fullname'];
401 $listofpaths = array($file);
402 $listofnames = array(basename($file));
406 $moreinheader =
'X-Dolibarr-Info: send_an_email by adherents/subscription.php'.
"\r\n";
408 $result = $object->sendEmail($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames,
"",
"", 0, -1,
'', $moreinheader);
410 $errmsg = $object->error;
413 setEventMessages($langs->trans(
"EmailSentToMember", $object->email),
null,
'mesgs');
423 $_POST[
"subscription"] =
'';
424 $_POST[
"accountid"] =
'';
425 $_POST[
"operation"] =
'';
426 $_POST[
"label"] =
'';
427 $_POST[
"num_chq"] =
'';
442 $title = $langs->trans(
"Member").
" - ".$langs->trans(
"Subscriptions");
444 $help_url =
"EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder";
450 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
451 $param .=
'&contextpage='.urlencode($contextpage);
453 if ($limit > 0 && $limit != $conf->liste_limit) {
454 $param .=
'&limit='.((int) $limit);
456 $param .=
'&id='.$rowid;
457 if ($optioncss !=
'') {
458 $param .=
'&optioncss='.urlencode($optioncss);
464 if (! ($object->id > 0)) {
465 $langs->load(
"errors");
466 print $langs->trans(
"ErrorRecordNotFound");
476 $adht->fetch($object->typeid);
478 $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1;
479 $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit :
'y';
484 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
491 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
492 print
'<input type="hidden" name="token" value="'.newToken().
'">';
493 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
497 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
499 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/adherents/vcard.php?id='.$object->id.
'" class="refid">';
500 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
501 $morehtmlref .=
'</a>';
503 dol_banner_tab($object,
'rowid', $linkback, 1,
'rowid',
'ref', $morehtmlref);
505 print
'<div class="fichecenter">';
506 print
'<div class="fichehalfleft">';
508 print
'<div class="underbanner clearboth"></div>';
509 print
'<table class="border centpercent tableforfield">';
512 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
513 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
dol_escape_htmltag($object->login).
'</td></tr>';
517 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td>';
518 print
'<td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
521 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td>';
522 print
'<td class="valeur" >'.$object->getmorphylib(
'', 1).
'</td>';
526 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.
dol_escape_htmltag($object->company).
'</td></tr>';
529 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$object->getCivilityLabel().
'</td>';
533 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
534 print
'<tr><td>'.$langs->trans(
"Password").
'</td><td>';
536 print preg_replace(
'/./i',
'*', $object->pass);
539 print
'<!-- '.$langs->trans(
"Crypted").
': '.$object->pass_indatabase_crypted.
' -->';
541 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
543 if (!empty($object->pass_indatabase) && empty($object->user_id)) {
544 $langs->load(
"errors");
545 $htmltext = $langs->trans(
"WarningPasswordSetWithNoAccount");
546 print
' '.$form->textwithpicto(
'', $htmltext, 1,
'warning');
552 print
'<tr><td>'.$langs->trans(
"SubscriptionEndDate").
'</td><td class="valeur">';
553 if ($object->datefin) {
555 if ($object->hasDelay()) {
556 print
" ".img_warning($langs->trans(
"Late"));
559 if ($object->need_subscription == 0) {
560 print $langs->trans(
"SubscriptionNotNeeded");
561 } elseif (!$adht->subscription) {
562 print $langs->trans(
"SubscriptionNotRecorded");
564 print
" ".img_warning($langs->trans(
"Late"));
567 print $langs->trans(
"SubscriptionNotReceived");
569 print
" ".img_warning($langs->trans(
"Late"));
579 print
'<div class="fichehalfright">';
580 print
'<div class="underbanner clearboth"></div>';
582 print
'<table class="border tableforfield centpercent">';
585 if (
isModEnabled(
'categorie') && $user->hasRight(
'categorie',
'lire')) {
586 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
587 print
'<td colspan="2">';
588 print
$form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
593 print
'<tr><td class="titlefield">'.$langs->trans(
"DateOfBirth").
'</td><td class="valeur">'.
dol_print_date($object->birth,
'day').
'</td></tr>';
597 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
598 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
601 $langs->load(
"languages");
602 $labellang = ($object->default_lang ? $langs->trans(
'Language_'.$object->default_lang) :
'');
603 print
picto_from_langcode($object->default_lang,
'class="paddingrightonly saturatemedium opacitylow"');
609 $linkofpubliclist = DOL_MAIN_URL_ROOT.
'/public/members/public_list.php'.((
isModEnabled(
'multicompany')) ?
'?entity='.$conf->entity :
'');
610 print
'<tr><td>'.$langs->trans(
"Public",
getDolGlobalString(
'MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).
'</td><td class="valeur">'.
yn($object->public).
'</td></tr>';
614 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
619 print
'<table class="nobordernopadding" width="100%"><tr><td>';
620 print $langs->trans(
"LinkedToDolibarrThirdParty");
622 if ($action !=
'editthirdparty' && $user->hasRight(
'adherent',
'creer')) {
623 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editthirdparty&token='.
newToken().
'&rowid='.$object->id.
'">'.
img_edit($langs->trans(
'SetLinkToThirdParty'), 1).
'</a></td>';
625 print
'</tr></table>';
626 print
'</td><td colspan="2" class="valeur">';
627 if ($action ==
'editthirdparty') {
629 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'" name="form'.$htmlname.
'">';
630 print
'<input type="hidden" name="rowid" value="'.$object->id.
'">';
631 print
'<input type="hidden" name="action" value="set'.$htmlname.
'">';
632 print
'<input type="hidden" name="token" value="'.newToken().
'">';
633 print
'<table class="nobordernopadding">';
635 print
$form->select_company($object->fk_soc,
'socid',
'', 1);
637 print
'<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"></td>';
638 print
'</tr></table></form>';
640 if ($object->fk_soc) {
642 $result = $company->fetch($object->fk_soc);
643 print $company->getNomUrl(1);
646 $tmparray = $company->getOutstandingBills(
'customer');
647 if (!empty($tmparray[
'refs'])) {
648 print
' - '.img_picto($langs->trans(
"Invoices"),
'bill',
'class="paddingright"').
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?socid='.$object->socid.
'">'.$langs->trans(
"Invoices").
' ('.count($tmparray[
'refs']).
')';
653 print
'<span class="opacitymedium">'.$langs->trans(
"NoThirdPartyAssociatedToMember").
'</span>';
661 print
'<table class="nobordernopadding" width="100%"><tr><td>';
662 print $langs->trans(
"LinkedToDolibarrUser");
664 if ($action !=
'editlogin' && $user->hasRight(
'adherent',
'creer')) {
665 print
'<td class="right">';
666 if ($user->hasRight(
"user",
"user",
"creer")) {
667 print
'<a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editlogin&token='.
newToken().
'&rowid='.$object->id.
'">'.
img_edit($langs->trans(
'SetLinkToUser'), 1).
'</a>';
671 print
'</tr></table>';
672 print
'</td><td colspan="2" class="valeur">';
673 if ($action ==
'editlogin') {
674 $form->form_users($_SERVER[
'PHP_SELF'].
'?rowid='.$object->id, $object->user_id,
'userid',
'');
676 if ($object->user_id) {
677 $linkeduser =
new User($db);
678 $linkeduser->fetch($object->user_id);
679 print $linkeduser->getNomUrl(-1);
681 print
'<span class="opacitymedium">'.$langs->trans(
"NoDolibarrAccess").
'</span>';
688 print
"</div></div>\n";
689 print
'<div class="clearboth"></div>';
699 if ($user->hasRight(
'adherent',
'cotisation',
'creer')) {
700 if ($action !=
'addsubscription' && $action !=
'create_thirdparty') {
701 print
'<div class="tabsAction">';
703 if ($object->statut > 0) {
704 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$rowid.
'&action=addsubscription&token='.
newToken().
'">'.$langs->trans(
"AddSubscription").
"</a></div>";
706 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"ValidateBefore")).
'">'.$langs->trans(
"AddSubscription").
'</a></div>';
716 if ($action !=
'addsubscription' && $action !=
'create_thirdparty') {
717 $sql =
"SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,";
718 $sql .=
" c.rowid as crowid, c.subscription,";
719 $sql .=
" c.datec, c.fk_type as cfk_type,";
720 $sql .=
" c.dateadh as dateh,";
722 $sql .=
" c.fk_bank,";
723 $sql .=
" b.rowid as bid,";
724 $sql .=
" ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number, ba.currency_code";
725 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d, ".MAIN_DB_PREFIX.
"subscription as c";
726 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON c.fk_bank = b.rowid";
727 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON b.fk_account = ba.rowid";
728 $sql .=
" WHERE d.rowid = c.fk_adherent AND d.rowid=".((int) $rowid);
729 $sql .= $db->order($sortfield, $sortorder);
731 $result = $db->query(
$sql);
735 $num = $db->num_rows($result);
737 print
'<table class="noborder centpercent">'.
"\n";
739 print
'<tr class="liste_titre">';
741 print_liste_field_titre(
'DateCreation', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
743 print_liste_field_titre(
'DateStart', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
744 print_liste_field_titre(
'DateEnd', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
747 print_liste_field_titre(
'Account', $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'right ');
751 $accountstatic =
new Account($db);
757 $objp = $db->fetch_object($result);
759 $adh->id = $objp->rowid;
760 $adh->typeid = $objp->type;
762 $subscriptionstatic->ref = $objp->crowid;
763 $subscriptionstatic->id = $objp->crowid;
765 $typeid = $objp->cfk_type;
767 $adht->fetch($typeid);
770 print
'<tr class="oddeven">';
771 print
'<td>'.$subscriptionstatic->getNomUrl(1).
'</td>';
772 print
'<td class="center">'.dol_print_date($db->jdate($objp->datec),
'dayhour').
"</td>\n";
773 print
'<td class="center">';
775 print $adht->getNomUrl(1);
778 print
'<td class="center">'.dol_print_date($db->jdate($objp->dateh),
'day').
"</td>\n";
779 print
'<td class="center">'.dol_print_date($db->jdate($objp->datef),
'day').
"</td>\n";
780 print
'<td class="right amount">'.price($objp->subscription).
'</td>';
782 print
'<td class="right">';
784 $accountstatic->label = $objp->label;
785 $accountstatic->id = $objp->baid;
786 $accountstatic->number = $objp->number;
787 $accountstatic->account_number = $objp->account_number;
788 $accountstatic->currency_code = $objp->currency_code;
790 if (
isModEnabled(
'accounting') && $objp->fk_accountancy_journal > 0) {
792 $accountingjournal->fetch($objp->fk_accountancy_journal);
794 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
797 $accountstatic->ref = $objp->ref;
798 print $accountstatic->getNomUrl(1);
813 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
823 if (($action !=
'addsubscription' && $action !=
'create_thirdparty')) {
827 if ($useonlinepayment) {
830 require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
831 print showOnlinePaymentUrl(
'membersubscription', $object->ref);
839 if (($action ==
'addsubscription' || $action ==
'create_thirdparty') && $user->hasRight(
'adherent',
'cotisation',
'creer')) {
849 if (
GETPOST(
'paymentsave') ==
'bankdirect') {
852 if (
GETPOST(
'paymentsave') ==
'invoiceonly') {
855 if (
GETPOST(
'paymentsave') ==
'bankviainvoice') {
859 if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE ==
'bankviainvoice' &&
isModEnabled(
'banque') &&
isModEnabled(
'societe') &&
isModEnabled(
'facture')) {
861 } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE ==
'bankdirect' &&
isModEnabled(
'banque')) {
863 } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE ==
'invoiceonly' &&
isModEnabled(
'banque') &&
isModEnabled(
'societe') &&
isModEnabled(
'facture')) {
868 print
"\n\n<!-- Form add subscription -->\n";
870 if ($conf->use_javascript_ajax) {
872 print
"\n".
'<script type="text/javascript">';
873 print
'$(document).ready(function () {
874 $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ?
'show()' :
'hide()').
';
875 $("#none, #invoiceonly").click(function() {
876 $(".bankswitchclass").hide();
877 $(".bankswitchclass2").hide();
879 $("#bankdirect, #bankviainvoice").click(function() {
880 $(".bankswitchclass").show();
881 $(".bankswitchclass2").show();
883 $("#selectoperation").change(function() {
884 var code = $(this).val();
887 $(".fieldrequireddyn").addClass("fieldrequired");
888 if ($("#fieldchqemetteur").val() == "")
890 $("#fieldchqemetteur").val($("#memberlabel").val());
895 $(".fieldrequireddyn").removeClass("fieldrequired");
900 print
'$("#'.GETPOST(
'paymentsave',
'aZ09').
'").prop("checked", true);';
903 print
'</script>'.
"\n";
908 if ($action ==
'create_thirdparty') {
910 $fullname = $object->getFullName($langs);
912 if ($object->morphy ==
'mor') {
913 $companyname = $object->company;
914 if (!empty($fullname)) {
915 $companyalias = $fullname;
918 $companyname = $fullname;
919 if (!empty($object->company)) {
920 $companyalias = $object->company;
925 $formquestion = array(
926 array(
'label' => $langs->trans(
"NameToCreate"),
'type' =>
'text',
'name' =>
'companyname',
'value' => $companyname,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"'),
927 array(
'label' => $langs->trans(
"AliasNames"),
'type' =>
'text',
'name' =>
'companyalias',
'value' => $companyalias,
'morecss' =>
'minwidth300',
'moreattr' =>
'maxlength="128"')
930 if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED)) {
931 $tmpcompany =
new Societe($db);
932 $tmpcompany->name = $companyname;
933 $tmpcompany->get_codeclient($tmpcompany, 0);
934 $customercode = $tmpcompany->code_client;
935 $formquestion[] = array(
936 'label' => $langs->trans(
"CustomerCode"),
938 'name' =>
'customercode',
939 'value' => $customercode,
940 'morecss' =>
'minwidth300',
941 'moreattr' =>
'maxlength="128"',
946 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"CreateDolibarrThirdParty"), $langs->trans(
"ConfirmCreateThirdParty"),
"confirm_create_thirdparty", $formquestion, 1);
950 print
'<form name="subscription" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
951 print
'<input type="hidden" name="token" value="'.newToken().
'">';
952 print
'<input type="hidden" name="action" value="subscription">';
953 print
'<input type="hidden" name="rowid" value="'.$rowid.
'">';
954 print
'<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).
'">';
955 print
'<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->company).
'">';
959 print
'<div class="div-table-responsive">';
960 print
'<table class="border centpercent">'.
"\n";
974 print
'<td class="fieldrequired">'.$langs->trans(
"DateSubscription").
'</td><td>';
979 $datefrom = $object->datevalid;
986 print
$form->selectDate($datefrom,
'',
'',
'',
'',
"subscription", 1, 1);
996 } elseif (
getDolGlobalInt(
'MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) {
1002 print
'<tr><td>'.$langs->trans(
"DateEndSubscription").
'</td><td>';
1003 print
$form->selectDate($dateto,
'end',
'',
'',
'',
"subscription", 1, 0);
1006 if ($adht->subscription) {
1008 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input type="text" name="subscription" size="6" value="'.(
GETPOSTISSET(
'subscription') ?
GETPOST(
'subscription') :
price($adht->amount, 0,
'', 0)).
'"> '.$langs->trans(
"Currency".$conf->currency) .
'</td></tr>';
1011 print
'<tr><td>'.$langs->trans(
"Label").
'</td>';
1012 print
'<td><input name="label" type="text" size="32" value="';
1014 print $langs->trans(
"Subscription").
' '.
dol_print_date(($datefrom ? $datefrom : time()),
"%Y");
1016 print
'"></td></tr>';
1021 if ($object->socid) {
1022 $result = $company->fetch($object->socid);
1026 print
'<tr><td class="tdtop fieldrequired">'.$langs->trans(
'MoreActions');
1028 print
'<td class="line-height-large">';
1030 print
'<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice) ?
' checked' :
'').
'>';
1031 print
'<label for="none"> '.$langs->trans(
"None").
'</label><br>';
1034 print
'<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(!empty($bankdirect) ?
' checked' :
'');
1035 print
'><label for="bankdirect"> '.$langs->trans(
"MoreActionBankDirect").
'</label><br>';
1039 print
'<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ?
' checked' :
'');
1041 print
'><label for="invoiceonly"> '.$langs->trans(
"MoreActionInvoiceOnly");
1042 if ($object->fk_soc) {
1043 print
' ('.$langs->trans(
"ThirdParty").
': '.$company->getNomUrl(1).
')';
1046 if (empty($object->fk_soc)) {
1047 print
img_warning($langs->trans(
"NoThirdPartyAssociatedToMember"));
1049 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1050 print
' - <a href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'&action=create_thirdparty">';
1051 print $langs->trans(
"CreateDolibarrThirdParty");
1054 if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS !=
'defaultforfoundationcountry') {
1055 print
'. <span class="opacitymedium">'.$langs->trans(
"NoVatOnSubscription", 0).
'</span>';
1057 if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (
isModEnabled(
'product') ||
isModEnabled(
'service'))) {
1059 $result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
1063 print
'. '.$langs->transnoentitiesnoconv(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
1065 print
'</label><br>';
1069 print
'<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(!empty($bankviainvoice) ?
' checked' :
'');
1071 print
'><label for="bankviainvoice"> '.$langs->trans(
"MoreActionBankViaInvoice");
1072 if ($object->socid) {
1073 print
' ('.$langs->trans(
"ThirdParty").
': '.$company->getNomUrl(1).
')';
1076 if (empty($object->socid)) {
1077 print
img_warning($langs->trans(
"NoThirdPartyAssociatedToMember"));
1079 print $langs->trans(
"NoThirdPartyAssociatedToMember");
1080 print
' - <a href="'.$_SERVER[
"PHP_SELF"].
'?rowid='.$object->id.
'&action=create_thirdparty">';
1081 print $langs->trans(
"CreateDolibarrThirdParty");
1084 if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS !=
'defaultforfoundationcountry') {
1085 print
'. <span class="opacitymedium">'.$langs->trans(
"NoVatOnSubscription", 0).
'</span>';
1087 if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (
isModEnabled(
'product')||
isModEnabled(
'service'))) {
1089 $result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
1093 print
'. '.$langs->transnoentitiesnoconv(
"ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1));
1095 print
'</label><br>';
1100 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"FinancialAccount").
'</td><td>';
1102 $form->select_comptes(
GETPOST(
'accountid'),
'accountid', 0,
'', 2,
'', 0,
'minwidth200');
1103 print
"</td></tr>\n";
1106 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"PaymentMode").
'</td><td>';
1107 print
$form->select_types_paiements(
GETPOST(
'operation'),
'operation',
'', 2, 1, 0, 0, 1,
'minwidth200', 1);
1108 print
"</td></tr>\n";
1111 print
'<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
1112 print
$form->selectDate(isset($paymentdate) ? $paymentdate : -1,
'payment', 0, 0, 1,
'subscription', 1, 1);
1113 print
"</td></tr>\n";
1115 print
'<tr class="bankswitchclass2"><td>'.$langs->trans(
'Numero');
1116 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
1118 print
'<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(!
GETPOST(
'num_chq') ?
'' :
GETPOST(
'num_chq')).
'"></td></tr>';
1120 print
'<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans(
'CheckTransmitter');
1121 print
' <em>('.$langs->trans(
"ChequeMaker").
')</em>';
1123 print
'<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(!
GETPOST(
'chqemetteur') ?
'' :
GETPOST(
'chqemetteur')).
'"></td></tr>';
1125 print
'<tr class="bankswitchclass2"><td>'.$langs->trans(
'Bank');
1126 print
' <em>('.$langs->trans(
"ChequeBank").
')</em>';
1128 print
'<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(!
GETPOST(
'chqbank') ?
'' :
GETPOST(
'chqbank')).
'"></td></tr>';
1132 print
'<tr><td></td><td></td></tr>';
1134 print
'<tr><td>'.$langs->trans(
"SendAcknowledgementByMail").
'</td>';
1136 if (!$object->email) {
1137 print $langs->trans(
"NoEMail");
1140 $adht->fetch($object->typeid);
1147 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
1150 $outputlangs =
new Translate(
'', $conf);
1151 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1153 $outputlangs->loadLangs(array(
"main",
"members"));
1155 $arraydefaultmessage =
null;
1156 $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
1158 if (!empty($labeltouse)) {
1159 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'member', $user, $outputlangs, 0, 1, $labeltouse);
1162 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
1163 $subject = $arraydefaultmessage->topic;
1164 $msg = $arraydefaultmessage->content;
1172 $tmp =
'<input name="sendmail" type="checkbox"'.(GETPOST(
'sendmail',
'alpha') ?
' checked' : (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ?
' checked' :
'')).
'>';
1174 $helpcontent .=
'<b>'.$langs->trans(
"MailFrom").
'</b>: '.
getDolGlobalString(
'ADHERENT_MAIL_FROM').
'<br>'.
"\n";
1175 $helpcontent .=
'<b>'.$langs->trans(
"MailRecipient").
'</b>: '.$object->email.
'<br>'.
"\n";
1176 $helpcontent .=
'<b>'.$langs->trans(
"MailTopic").
'</b>:<br>'.
"\n";
1177 if ($subjecttosend) {
1178 $helpcontent .= $subjecttosend.
"\n";
1180 $langs->load(
"errors");
1181 $helpcontent .=
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Module310Name")).
'</span>'.
"\n";
1183 $helpcontent .=
"<br>";
1184 $helpcontent .=
'<b>'.$langs->trans(
"MailText").
'</b>:<br>';
1188 $langs->load(
"errors");
1189 $helpcontent .=
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"Module310Name")).
'</span>'.
"\n";
1191 print
$form->textwithpicto($tmp, $helpcontent, 1,
'help',
'', 0, 2,
'helpemailtosend');
1200 print
'<div class="center">';
1201 $parameters = array();
1202 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1203 if (empty($reshook)) {
1204 print
'<input type="submit" class="button" name="add" value="'.$langs->trans(
"AddSubscription").
'">';
1205 print
' ';
1206 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1212 print
"\n<!-- End form subscription -->\n\n";
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage accounting accounts.
Class to manage members of a foundation.
const STATUS_VALIDATED
Validated status.
Class to manage members type.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage subscriptions of foundation members.
Class to manage translations.
Class to manage Dolibarr users.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_most_recent_file($dir, $regexfilter='', $excludefilter=array('(\.meta|_preview.*\.png)$', '^\.'), $nohook=false, $mode='')
Return file(s) into a directory (by default most recent)
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.