dolibarr  9.0.0
subscription.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2012-2017 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
7  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
36 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
37 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
38 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
39 
40 $langs->loadLangs(array("companies","bills","members","users","mails",'other'));
41 
42 $action=GETPOST('action','alpha');
43 $confirm=GETPOST('confirm','alpha');
44 $rowid=GETPOST('rowid','int')?GETPOST('rowid','int'):GETPOST('id','int');
45 $typeid=GETPOST('typeid','int');
46 
47 // Load variable for pagination
48 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
49 $sortfield = GETPOST('sortfield','alpha');
50 $sortorder = GETPOST('sortorder','alpha');
51 $page = GETPOST('page','int');
52 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
53 $offset = $limit * $page;
54 $pageprev = $page - 1;
55 $pagenext = $page + 1;
56 
57 // Default sort order (if not yet defined by previous GETPOST)
58 if (! $sortfield) $sortfield="c.rowid";
59 if (! $sortorder) $sortorder="DESC";
60 
61 
62 // Security check
63 $result=restrictedArea($user,'adherent',$rowid,'','cotisation');
64 
65 $object = new Adherent($db);
66 $extrafields = new ExtraFields($db);
67 $adht = new AdherentType($db);
68 
69 // fetch optionals attributes and labels
70 $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
71 
72 $errmsg='';
73 $errmsgs=array();
74 
75 $defaultdelay=1;
76 $defaultdelayunit='y';
77 
78 if ($rowid)
79 {
80  // Load member
81  $result = $object->fetch($rowid);
82 
83  // Define variables to know what current user can do on users
84  $canadduser=($user->admin || $user->rights->user->user->creer);
85  // Define variables to know what current user can do on properties of user linked to edited member
86  if ($object->user_id)
87  {
88  // $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite
89  $caneditfielduser=( (($user->id == $object->user_id) && $user->rights->user->self->creer)
90  || (($user->id != $object->user_id) && $user->rights->user->user->creer) );
91  $caneditpassworduser=( (($user->id == $object->user_id) && $user->rights->user->self->password)
92  || (($user->id != $object->user_id) && $user->rights->user->user->password) );
93  }
94 }
95 
96 // Define variables to know what current user can do on members
97 $canaddmember=$user->rights->adherent->creer;
98 // Define variables to know what current user can do on properties of a member
99 if ($rowid)
100 {
101  $caneditfieldmember=$user->rights->adherent->creer;
102 }
103 
104 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
105 $hookmanager->initHooks(array('subscription'));
106 
107 // PDF
108 $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
109 $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
110 $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
111 
112 
113 /*
114  * Actions
115  */
116 
117 // Create third party from a member
118 if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
119 {
120  if ($result > 0)
121  {
122  // Creation of thirdparty
123  $company = new Societe($db);
124  $result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha'), GETPOST('customercode', 'alpha'));
125 
126  if ($result < 0)
127  {
128  $langs->load("errors");
129  setEventMessages($company->error, $company->errors, 'errors');
130  }
131  else
132  {
133  $action='addsubscription';
134  }
135  }
136  else
137  {
138  setEventMessages($object->error, $object->errors, 'errors');
139  }
140 }
141 
142 if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
143 {
144  $error=0;
145  if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
146  {
147  if ($_POST["userid"] != $user->id && $_POST["userid"] != $object->user_id)
148  {
149  $error++;
150  setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors');
151  }
152  }
153 
154  if (! $error)
155  {
156  if ($_POST["userid"] != $object->user_id) // If link differs from currently in database
157  {
158  $result=$object->setUserId($_POST["userid"]);
159  if ($result < 0) dol_print_error('',$object->error);
160  $_POST['action']='';
161  $action='';
162  }
163  }
164 }
165 
166 if ($action == 'setsocid')
167 {
168  $error=0;
169  if (! $error)
170  {
171  if (GETPOST('socid','int') != $object->fk_soc) // If link differs from currently in database
172  {
173  $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
174  $sql.=" WHERE fk_soc = '".GETPOST('socid','int')."'";
175  $resql = $db->query($sql);
176  if ($resql)
177  {
178  $obj = $db->fetch_object($resql);
179  if ($obj && $obj->rowid > 0)
180  {
181  $othermember=new Adherent($db);
182  $othermember->fetch($obj->rowid);
183  $thirdparty=new Societe($db);
184  $thirdparty->fetch(GETPOST('socid','int'));
185  $error++;
186  setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), null, 'errors');
187  }
188  }
189 
190  if (! $error)
191  {
192  $result=$object->setThirdPartyId(GETPOST('socid','int'));
193  if ($result < 0) dol_print_error('',$object->error);
194  $_POST['action']='';
195  $action='';
196  }
197  }
198  }
199 }
200 
201 if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $_POST["cancel"])
202 {
203  $error=0;
204 
205  $langs->load("banks");
206 
207  $result = $object->fetch($rowid);
208  $result = $adht->fetch($object->typeid);
209 
210  // Subscription informations
211  $datesubscription=0;
212  $datesubend=0;
213  $paymentdate=0;
214  if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"])
215  {
216  $datesubscription=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
217  }
218  if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"])
219  {
220  $datesubend=dol_mktime(0, 0, 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
221  }
222  if ($_POST["paymentyear"] && $_POST["paymentmonth"] && $_POST["paymentday"])
223  {
224  $paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
225  }
226  $amount=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
227  $label=$_POST["label"];
228 
229  // Payment informations
230  $accountid=$_POST["accountid"];
231  $operation=$_POST["operation"]; // Payment mode
232  $num_chq=$_POST["num_chq"];
233  $emetteur_nom=$_POST["chqemetteur"];
234  $emetteur_banque=$_POST["chqbank"];
235  $option=$_POST["paymentsave"];
236  if (empty($option)) $option='none';
237  $sendalsoemail=GETPOST("sendmail",'alpha');
238 
239  // Check parameters
240  if (! $datesubscription)
241  {
242  $error++;
243  $langs->load("errors");
244  $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
245  setEventMessages($errmsg, null, 'errors');
246  $action='addsubscription';
247  }
248  if (GETPOST('end') && ! $datesubend)
249  {
250  $error++;
251  $langs->load("errors");
252  $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
253  setEventMessages($errmsg, null, 'errors');
254  $action='addsubscription';
255  }
256  if (! $datesubend)
257  {
258  $datesubend=dol_time_plus_duree(dol_time_plus_duree($datesubscription,$defaultdelay,$defaultdelayunit),-1,'d');
259  }
260  if (($option == 'bankviainvoice' || $option == 'bankdirect') && ! $paymentdate)
261  {
262  $error++;
263  $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
264  setEventMessages($errmsg, null, 'errors');
265  $action='addsubscription';
266  }
267 
268  // Check if a payment is mandatory or not
269  if (! $error && $adht->subscription) // Member type need subscriptions
270  {
271  if (! is_numeric($amount))
272  {
273  // If field is '' or not a numeric value
274  $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
275  setEventMessages($errmsg, null, 'errors');
276  $error++;
277  $action='addsubscription';
278  }
279  else
280  {
281  if (! empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none')
282  {
283  if ($_POST["subscription"])
284  {
285  if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
286  if ($_POST["paymentsave"] != 'invoiceonly' && ! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
287  if ($_POST["paymentsave"] != 'invoiceonly' && ! ($_POST["accountid"] > 0)) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("FinancialAccount"));
288  }
289  else
290  {
291  if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
292  }
293  if ($errmsg)
294  {
295  $error++;
296  setEventMessages($errmsg, null, 'errors');
297  $error++;
298  $action='addsubscription';
299  }
300  }
301  }
302  }
303 
304  // Record the subscription then complementary actions
305  if (! $error && $action=='subscription')
306  {
307  $db->begin();
308 
309  // Create subscription
310  $crowid=$object->subscription($datesubscription, $amount, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
311  if ($crowid <= 0)
312  {
313  $error++;
314  $errmsg=$object->error;
315  setEventMessages($object->error,$object->errors, 'errors');
316  }
317 
318  if (! $error)
319  {
320  $result = $object->subscriptionComplementaryActions($crowid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom, $emetteur_banque);
321  if ($result < 0)
322  {
323  $error++;
324  setEventMessages($object->error, $object->errors, 'errors');
325  }
326  else
327  {
328  // If an invoice was created, it is into $object->invoice
329  }
330  }
331 
332  if (! $error)
333  {
334  $db->commit();
335  }
336  else
337  {
338  $db->rollback();
339  $action = 'addsubscription';
340  }
341 
342  if (! $error)
343  {
344  setEventMessages("SubscriptionRecorded", null, 'mesgs');
345  }
346 
347  // Send email
348  if (! $error)
349  {
350  // Send confirmation Email
351  if ($object->email && $sendalsoemail) // $object is 'Adherent'
352  {
353  $subject = '';
354  $msg= '';
355 
356  // Send subscription email
357  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
358  $formmail=new FormMail($db);
359  // Set output language
360  $outputlangs = new Translate('', $conf);
361  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
362  // Load traductions files requiredby by page
363  $outputlangs->loadLangs(array("main", "members"));
364 
365  // Get email content from template
366  $arraydefaultmessage=null;
367  $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
368 
369  if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
370 
371  if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
372  {
373  $subject = $arraydefaultmessage->topic;
374  $msg = $arraydefaultmessage->content;
375  }
376 
377  $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
378  complete_substitutions_array($substitutionarray, $outputlangs, $object);
379  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
380  $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
381 
382  // Attach a file ?
383  $file='';
384  $listofpaths=array();
385  $listofnames=array();
386  $listofmimes=array();
387  if (is_object($object->invoice))
388  {
389  $invoicediroutput = $conf->facture->dir_output;
390  $fileparams = dol_most_recent_file($invoicediroutput . '/' . $object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+');
391  $file = $fileparams['fullname'];
392 
393  $listofpaths=array($file);
394  $listofnames=array(basename($file));
395  $listofmimes=array(dol_mimetype($file));
396  }
397 
398  $moreinheader='X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
399 
400  $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader);
401  if ($result < 0)
402  {
403  $errmsg=$object->error;
404  setEventMessages($object->error, $object->errors, 'errors');
405  }
406  else
407  {
408  setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
409  }
410  }
411  else
412  {
413  setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
414  }
415  }
416 
417  // Clean some POST vars
418  if (! $error)
419  {
420  $_POST["subscription"]='';
421  $_POST["accountid"]='';
422  $_POST["operation"]='';
423  $_POST["label"]='';
424  $_POST["num_chq"]='';
425  }
426  }
427 }
428 
429 
430 
431 /*
432  * View
433  */
434 
435 $form = new Form($db);
436 
437 $now=dol_now();
438 
439 $title=$langs->trans("Member") . " - " . $langs->trans("Subscriptions");
440 $helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
441 llxHeader("",$title,$helpurl);
442 
443 
444 $param='';
445 if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
446 if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
447 $param.= '&id='.$rowid;
448 if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
449 // Add $param from extra fields
450 //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
451 
452 
453 if ($rowid > 0)
454 {
455  $res=$object->fetch($rowid);
456  if ($res < 0) { dol_print_error($db,$object->error); exit; }
457 
458  $adht->fetch($object->typeid);
459 
460  $head = member_prepare_head($object);
461 
462  $rowspan=10;
463  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
464  if (! empty($conf->societe->enabled)) $rowspan++;
465 
466  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
467  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
468  print '<input type="hidden" name="rowid" value="'.$object->id.'">';
469 
470  dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
471 
472  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
473 
474  dol_banner_tab($object, 'rowid', $linkback);
475 
476  print '<div class="fichecenter">';
477  print '<div class="fichehalfleft">';
478 
479  print '<div class="underbanner clearboth"></div>';
480  print '<table class="border" width="100%">';
481 
482  // Login
483  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
484  {
485  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
486  }
487 
488  // Type
489  print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
490 
491  // Morphy
492  print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
493  print '</tr>';
494 
495  // Company
496  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
497 
498  // Civility
499  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
500  print '</tr>';
501 
502  // Password
503  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
504  {
505  print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i','*',$object->pass);
506  if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id))
507  {
508  $langs->load("errors");
509  $htmltext=$langs->trans("WarningPasswordSetWithNoAccount");
510  print ' '.$form->textwithpicto('', $htmltext,1,'warning');
511  }
512  print '</td></tr>';
513  }
514 
515  print '</table>';
516 
517  print '</div>';
518  print '<div class="fichehalfright"><div class="ficheaddleft">';
519 
520  print '<div class="underbanner clearboth"></div>';
521  print '<table class="border tableforfield" width="100%">';
522 
523  // Birthday
524  print '<tr><td class="titlefield">'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
525 
526  // Public
527  print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
528 
529  // Categories
530  if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
531  {
532  print '<tr><td>' . $langs->trans("Categories") . '</td>';
533  print '<td colspan="2">';
534  print $form->showCategories($object->id, 'member', 1);
535  print '</td></tr>';
536  }
537 
538  // Other attributes
539  $cols=2;
540  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
541 
542  // Date end subscription
543  print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
544  if ($object->datefin)
545  {
546  print dol_print_date($object->datefin,'day');
547  if ($object->hasDelay()) {
548  print " ".img_warning($langs->trans("Late"));
549  }
550  }
551  else
552  {
553  if (! $adht->subscription)
554  {
555  print $langs->trans("SubscriptionNotRecorded");
556  if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
557  }
558  else
559  {
560  print $langs->trans("SubscriptionNotReceived");
561  if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
562  }
563  }
564  print '</td></tr>';
565 
566  // Third party Dolibarr
567  if (! empty($conf->societe->enabled))
568  {
569  print '<tr><td>';
570  print '<table class="nobordernopadding" width="100%"><tr><td>';
571  print $langs->trans("LinkedToDolibarrThirdParty");
572  print '</td>';
573  if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
574  print '</tr></table>';
575  print '</td><td colspan="2" class="valeur">';
576  if ($action == 'editthirdparty')
577  {
578  $htmlname='socid';
579  print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
580  print '<input type="hidden" name="rowid" value="'.$object->id.'">';
581  print '<input type="hidden" name="action" value="set'.$htmlname.'">';
582  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
583  print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
584  print '<tr><td>';
585  print $form->select_company($object->fk_soc,'socid','',1);
586  print '</td>';
587  print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
588  print '</tr></table></form>';
589  }
590  else
591  {
592  if ($object->fk_soc)
593  {
594  $company=new Societe($db);
595  $result=$company->fetch($object->fk_soc);
596  print $company->getNomUrl(1);
597  }
598  else
599  {
600  print $langs->trans("NoThirdPartyAssociatedToMember");
601  }
602  }
603  print '</td></tr>';
604  }
605 
606  // Login Dolibarr
607  print '<tr><td>';
608  print '<table class="nobordernopadding" width="100%"><tr><td>';
609  print $langs->trans("LinkedToDolibarrUser");
610  print '</td>';
611  if ($action != 'editlogin' && $user->rights->adherent->creer)
612  {
613  print '<td align="right">';
614  if ($user->rights->user->user->creer)
615  {
616  print '<a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a>';
617  }
618  print '</td>';
619  }
620  print '</tr></table>';
621  print '</td><td colspan="2" class="valeur">';
622  if ($action == 'editlogin')
623  {
624  $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid','');
625  }
626  else
627  {
628  if ($object->user_id)
629  {
630  $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none');
631  }
632  else print $langs->trans("NoDolibarrAccess");
633  }
634  print '</td></tr>';
635 
636  print "</table>\n";
637 
638  print "</div></div></div>\n";
639  print '<div style="clear:both"></div>';
640 
641  dol_fiche_end();
642 
643  print '</form>';
644 
645 
646  /*
647  * Action buttons
648  */
649 
650  // Button to create a new subscription if member no draft neither resiliated
651  if ($user->rights->adherent->cotisation->creer)
652  {
653  if ($action != 'addsubscription' && $action != 'create_thirdparty')
654  {
655  print '<div class="tabsAction">';
656 
657  if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
658  else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
659 
660  print '</div>';
661  }
662  }
663 
664  /*
665  * List of subscriptions
666  */
667  if ($action != 'addsubscription' && $action != 'create_thirdparty')
668  {
669  $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
670  $sql.= " c.rowid as crowid, c.subscription,";
671  $sql.= " c.datec,";
672  $sql.= " c.dateadh as dateh,";
673  $sql.= " c.datef,";
674  $sql.= " c.fk_bank,";
675  $sql.= " b.rowid as bid,";
676  $sql.= " ba.rowid as baid, ba.label, ba.bank, ba.ref, ba.account_number, ba.fk_accountancy_journal, ba.number";
677  $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
678  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
679  $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
680  $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
681  $sql.= $db->order($sortfield, $sortorder);
682 
683  $result = $db->query($sql);
684  if ($result)
685  {
686  $subscriptionstatic=new Subscription($db);
687 
688  $num = $db->num_rows($result);
689  $i = 0;
690 
691  print '<table class="noborder" width="100%">'."\n";
692 
693  print '<tr class="liste_titre">';
694  print_liste_field_titre('Ref',$_SERVER["PHP_SELF"],'c.rowid','',$param,'',$sortfield,$sortorder);
695  print '<td align="center">'.$langs->trans("DateCreation").'</td>';
696  print '<td align="center">'.$langs->trans("DateStart").'</td>';
697  print '<td align="center">'.$langs->trans("DateEnd").'</td>';
698  print '<td align="right">'.$langs->trans("Amount").'</td>';
699  if (! empty($conf->banque->enabled))
700  {
701  print '<td align="right">'.$langs->trans("Account").'</td>';
702  }
703  print "</tr>\n";
704 
705  $accountstatic=new Account($db);
706 
707  while ($i < $num)
708  {
709  $objp = $db->fetch_object($result);
710 
711  $subscriptionstatic->ref=$objp->crowid;
712  $subscriptionstatic->id=$objp->crowid;
713 
714  print '<tr class="oddeven">';
715  print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
716  print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
717  print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
718  print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
719  print '<td align="right">'.price($objp->subscription).'</td>';
720  if (! empty($conf->banque->enabled))
721  {
722  print '<td align="right">';
723  if ($objp->bid)
724  {
725  $accountstatic->label=$objp->label;
726  $accountstatic->id=$objp->baid;
727  $accountstatic->number=$objp->number;
728  $accountstatic->account_number=$objp->account_number;
729 
730  if (! empty($conf->accounting->enabled))
731  {
732  $accountingjournal = new AccountingJournal($db);
733  $accountingjournal->fetch($objp->fk_accountancy_journal);
734 
735  $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
736  }
737 
738  $accountstatic->ref=$objp->ref;
739  print $accountstatic->getNomUrl(1);
740  }
741  else
742  {
743  print '&nbsp;';
744  }
745  print '</td>';
746  }
747  print "</tr>";
748  $i++;
749  }
750  print "</table>";
751  }
752  else
753  {
754  dol_print_error($db);
755  }
756  }
757 
758 
759  if (($action != 'addsubscription' && $action != 'create_thirdparty'))
760  {
761  // Shon online payment link
762  $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
763 
764  if ($useonlinepayment)
765  {
766  print '<br>';
767 
768  require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
769  print showOnlinePaymentUrl('membersubscription', $object->ref);
770  print '<br>';
771  }
772  }
773 
774  /*
775  * Add new subscription form
776  */
777  if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->rights->adherent->cotisation->creer)
778  {
779  print '<br>';
780 
781  print load_fiche_titre($langs->trans("NewCotisation"));
782 
783  // Define default choice for complementary actions
784  $bankdirect=0; // 1 means option by default is write to bank direct with no invoice
785  $invoiceonly=0; // 1 means option by default is invoice only
786  $bankviainvoice=0; // 1 means option by default is write to bank via invoice
787  if (GETPOST('paymentsave'))
788  {
789  if (GETPOST('paymentsave') == 'bankdirect') $bankdirect=1;
790  if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly=1;
791  if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice=1;
792  }
793  else
794  {
795  if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $bankviainvoice=1;
796  else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1;
797  else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $invoiceonly=1;
798  }
799 
800  print "\n\n<!-- Form add subscription -->\n";
801 
802  if ($conf->use_javascript_ajax)
803  {
804  //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
805  print "\n".'<script type="text/javascript" language="javascript">';
806  print '$(document).ready(function () {
807  $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect||$bankviainvoice)?'show()':'hide()').';
808  $("#none, #invoiceonly").click(function() {
809  $(".bankswitchclass").hide();
810  $(".bankswitchclass2").hide();
811  });
812  $("#bankdirect, #bankviainvoice").click(function() {
813  $(".bankswitchclass").show();
814  $(".bankswitchclass2").show();
815  });
816  $("#selectoperation").change(function() {
817  var code = $(this).val();
818  if (code == "CHQ")
819  {
820  $(".fieldrequireddyn").addClass("fieldrequired");
821  if ($("#fieldchqemetteur").val() == "")
822  {
823  $("#fieldchqemetteur").val($("#memberlabel").val());
824  }
825  }
826  else
827  {
828  $(".fieldrequireddyn").removeClass("fieldrequired");
829  }
830  });
831  ';
832  if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);';
833  print '});';
834  print '</script>'."\n";
835  }
836 
837 
838  // Confirm create third party
839  if ($action == 'create_thirdparty')
840  {
841  $companyalias='';
842  $fullname = $object->getFullName($langs);
843 
844  if ($object->morphy == 'mor')
845  {
846  $companyname=$object->societe;
847  if (! empty($fullname)) $companyalias=$fullname;
848  }
849  else
850  {
851  $companyname=$fullname;
852  if (! empty($object->societe)) $companyalias=$object->societe;
853  }
854 
855  // Create a form array
856  $formquestion=array(
857  array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'),
858  array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
859  );
860  // If customer code was forced to "required", we ask it at creation to avoid error later
861  if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED))
862  {
863  $tmpcompany = new Societe($db);
864  $tmpcompany->name=$companyname;
865  $tmpcompany->get_codeclient($tmpcompany, 0);
866  $customercode = $tmpcompany->code_client;
867  $formquestion[]=array(
868  'label' => $langs->trans("CustomerCode"),
869  'type' => 'text',
870  'name' => 'customercode',
871  'value' => $customercode,
872  'morecss' => 'minwidth300',
873  'moreattr' => 'maxlength="128"',
874  );
875  }
876  // @TODO Add other extrafields mandatory for thirdparty creation
877 
878  print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
879  }
880 
881 
882  print '<form name="subscription" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
883  print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
884  print '<input type="hidden" name="action" value="subscription">';
885  print '<input type="hidden" name="rowid" value="'.$rowid.'">';
886  print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
887  print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">';
888 
889  dol_fiche_head('');
890 
891  print "<table class=\"border\" width=\"100%\">\n";
892  print '<tbody>';
893 
894  $today=dol_now();
895  $datefrom=0;
896  $dateto=0;
897  $paymentdate=-1;
898 
899  // Date payment
900  if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday'))
901  {
902  $paymentdate=dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
903  }
904 
905  print '<tr>';
906  // Date start subscription
907  print '<td class="fieldrequired">'.$langs->trans("DateSubscription").'</td><td>';
908  if (GETPOST('reday'))
909  {
910  $datefrom=dol_mktime(0,0,0,GETPOST('remonth'),GETPOST('reday'),GETPOST('reyear'));
911  }
912  if (! $datefrom)
913  {
914  $datefrom=$object->datevalid;
915  if ($object->datefin > 0)
916  {
917  $datefrom=dol_time_plus_duree($object->datefin,1,'d');
918  }
919  }
920  print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
921  print "</td></tr>";
922 
923  // Date end subscription
924  if (GETPOST('endday'))
925  {
926  $dateto=dol_mktime(0,0,0,GETPOST('endmonth'),GETPOST('endday'),GETPOST('endyear'));
927  }
928  if (! $dateto)
929  {
930  $dateto=-1; // By default, no date is suggested
931  }
932  print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
933  print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0);
934  print "</td></tr>";
935 
936  if ($adht->subscription)
937  {
938  // Amount
939  print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
940 
941  // Label
942  print '<tr><td>'.$langs->trans("Label").'</td>';
943  print '<td><input name="label" type="text" size="32" value="';
944  if (empty($conf->global->MEMBER_NO_DEFAULT_LABEL)) print $langs->trans("Subscription").' '.dol_print_date(($datefrom?$datefrom:time()),"%Y");
945  print '"></td></tr>';
946 
947  // Complementary action
948  if (! empty($conf->banque->enabled) || ! empty($conf->facture->enabled))
949  {
950  $company=new Societe($db);
951  if ($object->fk_soc)
952  {
953  $result=$company->fetch($object->fk_soc);
954  }
955 
956  // Title payments
957  //print '<tr><td colspan="2"><b>'.$langs->trans("Payment").'</b></td></tr>';
958 
959  // No more action
960  print '<tr><td class="tdtop fieldrequired">'.$langs->trans('MoreActions');
961  print '</td>';
962  print '<td>';
963  print '<input type="radio" class="moreaction" id="none" name="paymentsave" value="none"'.(empty($bankdirect) && empty($invoiceonly) && empty($bankviainvoice)?' checked':'').'> '.$langs->trans("None").'<br>';
964  // Add entry into bank accoun
965  if (! empty($conf->banque->enabled))
966  {
967  print '<input type="radio" class="moreaction" id="bankdirect" name="paymentsave" value="bankdirect"'.(! empty($bankdirect)?' checked':'');
968  print '> '.$langs->trans("MoreActionBankDirect").'<br>';
969  }
970  // Add invoice with no payments
971  if (! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
972  {
973  print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(! empty($invoiceonly)?' checked':'');
974  //if (empty($object->fk_soc)) print ' disabled';
975  print '> '.$langs->trans("MoreActionInvoiceOnly");
976  if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
977  else
978  {
979  print ' (';
980  if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
981  print $langs->trans("NoThirdPartyAssociatedToMember");
982  print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
983  print $langs->trans("CreateDolibarrThirdParty");
984  print '</a>)';
985  }
986  if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0);
987  if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
988  {
989  $prodtmp=new Product($db);
990  $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
991  print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
992  }
993  print '<br>';
994  }
995  // Add invoice with payments
996  if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled))
997  {
998  print '<input type="radio" class="moreaction" id="bankviainvoice" name="paymentsave" value="bankviainvoice"'.(! empty($bankviainvoice)?' checked':'');
999  //if (empty($object->fk_soc)) print ' disabled';
1000  print '> '.$langs->trans("MoreActionBankViaInvoice");
1001  if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
1002  else
1003  {
1004  print ' (';
1005  if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
1006  print $langs->trans("NoThirdPartyAssociatedToMember");
1007  print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
1008  print $langs->trans("CreateDolibarrThirdParty");
1009  print '</a>)';
1010  }
1011  if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription",0);
1012  if (! empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
1013  {
1014  $prodtmp=new Product($db);
1015  $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
1016  print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
1017  }
1018  print '<br>';
1019  }
1020  print '</td></tr>';
1021 
1022  // Bank account
1023  print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("FinancialAccount").'</td><td>';
1024  $form->select_comptes(GETPOST('accountid'),'accountid',0,'',1);
1025  print "</td></tr>\n";
1026 
1027  // Payment mode
1028  print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
1029  $form->select_types_paiements(GETPOST('operation'),'operation','',2);
1030  print "</td></tr>\n";
1031 
1032  // Date of payment
1033  print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
1034  print $form->selectDate(isset($paymentdate)?$paymentdate:-1, 'payment', 0, 0, 1, 'subscription', 1, 1);
1035  print "</td></tr>\n";
1036 
1037  print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
1038  print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
1039  print '</td>';
1040  print '<td><input id="fieldnum_chq" name="num_chq" type="text" size="8" value="'.(! GETPOST('num_chq')?'':GETPOST('num_chq')).'"></td></tr>';
1041 
1042  print '<tr class="bankswitchclass2 fieldrequireddyn"><td>'.$langs->trans('CheckTransmitter');
1043  print ' <em>('.$langs->trans("ChequeMaker").')</em>';
1044  print '</td>';
1045  print '<td><input id="fieldchqemetteur" name="chqemetteur" size="32" type="text" value="'.(! GETPOST('chqemetteur')?'':GETPOST('chqemetteur')).'"></td></tr>';
1046 
1047  print '<tr class="bankswitchclass2"><td>'.$langs->trans('Bank');
1048  print ' <em>('.$langs->trans("ChequeBank").')</em>';
1049  print '</td>';
1050  print '<td><input id="chqbank" name="chqbank" size="32" type="text" value="'.(! GETPOST('chqbank')?'':GETPOST('chqbank')).'"></td></tr>';
1051  }
1052  }
1053 
1054  print '<tr><td colspan="2">&nbsp;</td>';
1055 
1056  print '<tr><td width="30%">'.$langs->trans("SendAcknowledgementByMail").'</td>';
1057  print '<td>';
1058  if (! $object->email)
1059  {
1060  print $langs->trans("NoEMail");
1061  }
1062  else
1063  {
1064  $adht = new AdherentType($db);
1065  $adht->fetch($object->typeid);
1066 
1067  // Send subscription email
1068  $subject = '';
1069  $msg= '';
1070 
1071  // Send subscription email
1072  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
1073  $formmail=new FormMail($db);
1074  // Set output language
1075  $outputlangs = new Translate('', $conf);
1076  $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
1077  // Load traductions files requiredby by page
1078  $outputlangs->loadLangs(array("main", "members"));
1079  // Get email content from template
1080  $arraydefaultmessage=null;
1081  $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
1082 
1083  if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
1084 
1085  if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
1086  {
1087  $subject = $arraydefaultmessage->topic;
1088  $msg = $arraydefaultmessage->content;
1089  }
1090 
1091  $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
1092  complete_substitutions_array($substitutionarray, $outputlangs, $object);
1093  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
1094  $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
1095 
1096  $tmp='<input name="sendmail" type="checkbox"'.(GETPOST('sendmail','alpha')?' checked':(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?' checked':'')).'>';
1097  $helpcontent='';
1098  $helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
1099  $helpcontent.='<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
1100  $helpcontent.='<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
1101  $helpcontent.=$subjecttosend."\n";
1102  $helpcontent.="<br>";
1103  $helpcontent.='<b>'.$langs->trans("MailText").'</b>:<br>';
1104  $helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
1105 
1106  print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
1107  }
1108  print '</td></tr>';
1109  print '</tbody>';
1110  print '</table>';
1111 
1112  dol_fiche_end();
1113 
1114  print '<div class="center">';
1115  print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
1116  print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1117  print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
1118  print '</div>';
1119 
1120  print '</form>';
1121 
1122  print "\n<!-- End form subscription -->\n\n";
1123  }
1124 
1125  //print '</td></tr>';
1126  //print '</table>';
1127 }
1128 else
1129 {
1130  $langs->load("errors");
1131  print $langs->trans("ErrorRecordNotFound");
1132 }
1133 
1134 // End of page
1135 llxFooter();
1136 $db->close();
img_warning($titlealt='default', $moreatt='')
Show warning logo.
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Classe permettant la generation du formulaire html d&#39;envoi de mail unitaire Usage: $formail = new For...
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->lire) if(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if(! empty($conf->facture->enabled) &&! empty($conf->commande->enabled) && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm=false, $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
img_edit($titlealt='default', $float=0, $other='class="pictoedit"')
Show logo editer/modifier fiche.
Class to manage products or services.
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_mimetype($file, $default='application/octet-stream', $mode=0)
Return mime type of a file.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_concatdesc($text1, $text2, $forxml=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
Class to manage bank accounts.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage members of a foundation.
llxHeader()
Empty header.
Definition: wrapper.php:44
dol_most_recent_file($dir, $regexfilter='', $excludefilter=array('(\.meta|_preview.*\.png)$','^\.'), $nohook=false, $mode='')
Return file(s) into a directory (by default most recent)
Definition: files.lib.php:2091
Class to manage translations.
dol_now($mode='gmt')
Return date for now.
Class to manage members type.
Class to manage subscriptions of foundation members.
dol_print_date($time, $format='', $tzoutput='tzserver', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
Show title line of an array.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Class to manage accounting accounts.
dol_time_plus_duree($time, $duration_value, $duration_unit)
Add a delay to a date.
Definition: date.lib.php:116
price2num($amount, $rounding='', $alreadysqlnb=0)
Function that return a number with universal decimal format (decimal separator is &#39;...
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
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...