26require 
'../../main.inc.php';
 
   27require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
 
   28require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
 
   29require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
 
   31if (isModEnabled(
"banque")) {
 
   32  require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
 
   36$langs->loadLangs(array(
"companies", 
"members", 
"bills", 
"users"));
 
   43$action = 
GETPOST(
"action", 
'alpha');
 
   45$typeid = 
GETPOST(
"typeid", 
"int");
 
   46$cancel = 
GETPOST(
'cancel', 
'alpha');
 
   48$note = 
GETPOST(
'note', 
'alpha');
 
   49$typeid = (int) 
GETPOST(
'typeid', 
'int');
 
   52if (!$user->hasRight(
'adherent', 
'cotisation', 
'lire')) {
 
   56$permissionnote = $user->hasRight(
'adherent', 
'cotisation', 
'creer'); 
 
   57$permissiondellink = $user->hasRight(
'adherent', 
'cotisation', 
'creer'); 
 
   58$permissiontoedit = $user->hasRight(
'adherent', 
'cotisation', 
'creer'); 
 
   60$hookmanager->initHooks(array(
'subscriptioncard', 
'globalcard'));
 
   76include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php'; 
 
   81if ($user->hasRight(
'adherent', 
'cotisation', 
'creer') && $action == 
'update' && !$cancel) {
 
   83  $result = $object->fetch($rowid);
 
   89    if ($object->fk_bank) {
 
   91      $result = $accountline->fetch($object->fk_bank);
 
   94      if ($accountline->rappro) {
 
   95        $errmsg = $langs->trans(
"SubscriptionLinkedToConciliatedTransaction");
 
   97        $accountline->datev = 
dol_mktime(
GETPOST(
'datesubhour', 
'int'), 
GETPOST(
'datesubmin', 
'int'), 0, 
GETPOST(
'datesubmonth', 
'int'), 
GETPOST(
'datesubday', 
'int'), 
GETPOST(
'datesubyear', 
'int'));
 
   98        $accountline->dateo = 
dol_mktime(
GETPOST(
'datesubhour', 
'int'), 
GETPOST(
'datesubmin', 
'int'), 0, 
GETPOST(
'datesubmonth', 
'int'), 
GETPOST(
'datesubday', 
'int'), 
GETPOST(
'datesubyear', 
'int'));
 
   99        $accountline->amount = $amount;
 
  100        $result = $accountline->update($user);
 
  102          $errmsg = $accountline->error;
 
  109      $object->dateh = 
dol_mktime(
GETPOST(
'datesubhour', 
'int'), 
GETPOST(
'datesubmin', 
'int'), 0, 
GETPOST(
'datesubmonth', 
'int'), 
GETPOST(
'datesubday', 
'int'), 
GETPOST(
'datesubyear', 
'int'));
 
  110      $object->datef = 
dol_mktime(
GETPOST(
'datesubendhour', 
'int'), 
GETPOST(
'datesubendmin', 
'int'), 0, 
GETPOST(
'datesubendmonth', 
'int'), 
GETPOST(
'datesubendday', 
'int'), 
GETPOST(
'datesubendyear', 
'int'));
 
  111      $object->fk_type = $typeid;
 
  112      $object->note_public = $note;
 
  113      $object->note_private = $note;
 
  115      $object->amount = $amount;
 
  117      $result = $object->update($user);
 
  118      if ($result >= 0 && !count($object->errors)) {
 
  121        header(
"Location: card.php?rowid=".$object->id);
 
  126        if ($object->error) {
 
  127          $errmsg = $object->error;
 
  129          foreach ($object->errors as $error) {
 
  144if ($action == 
'confirm_delete' && $confirm == 
'yes' && $user->hasRight(
'adherent', 
'cotisation', 
'creer')) {
 
  145  $result = $object->fetch($rowid);
 
  146  $result = $object->delete($user);
 
  148    header(
"Location: ".DOL_URL_ROOT.
"/adherents/card.php?rowid=".$object->fk_adherent);
 
  151    $errmesg = $adh->error;
 
  161$form = 
new Form($db);
 
  163$help_url = 
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
 
  164llxHeader(
'', $langs->trans(
"SubscriptionCard"), $help_url);
 
  170if ($user->hasRight(
'adherent', 
'cotisation', 
'creer') && $action == 
'edit') {
 
  177  $object->fetch($rowid);
 
  178  $result = $adh->fetch($object->fk_adherent);
 
  182  print 
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
 
  183  print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  184  print 
"<input type=\"hidden\" name=\"action\" value=\"update\">";
 
  185  print 
"<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
 
  186  print 
"<input type=\"hidden\" name=\"fk_bank\" value=\"".$object->fk_bank.
"\">";
 
  188  print 
dol_get_fiche_head($head, 
'general', $langs->trans(
"Subscription"), 0, 
'payment');
 
  190  $linkback = 
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
 
  193  print 
'<table class="border centpercent">';
 
  196  print 
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
 
  197  print 
'<td class="valeur">';
 
  198  print $form->showrefnav($object, 
'rowid', $linkback, 1);
 
  202  $adh->ref = $adh->getFullName($langs);
 
  204  print 
'<td>'.$langs->trans(
"Member").
'</td>';
 
  205  print 
'<td class="valeur">'.$adh->getNomUrl(-1, 0, 
'subscription').
'</td>';
 
  210  print 
'<td>'.$langs->trans(
"Type").
'</td>';
 
  211  print 
'<td class="valeur">';
 
  212  print $form->selectarray(
"typeid", $adht->liste_array(), (GETPOSTISSET(
"typeid") ? 
GETPOST(
"typeid") : $object->fk_type));
 
  216  print 
'<tr><td>'.$langs->trans(
"DateSubscription").
'</td>';
 
  217  print 
'<td class="valeur">';
 
  218  print $form->selectDate($object->dateh, 
'datesub', 1, 1, 0, 
'update', 1);
 
  223  print 
'<tr><td>'.$langs->trans(
"DateEndSubscription").
'</td>';
 
  224  print 
'<td class="valeur">';
 
  225  print $form->selectDate($object->datef, 
'datesubend', 0, 0, 0, 
'update', 1);
 
  230  print 
'<tr><td>'.$langs->trans(
"Amount").
'</td>';
 
  231  print 
'<td class="valeur">';
 
  232  print 
'<input type="text" class="flat width200" name="amount" value="'.price($object->amount).
'"></td></tr>';
 
  235  print 
'<tr><td>'.$langs->trans(
"Label").
'</td>';
 
  236  print 
'<td class="valeur">';
 
  237  print 
'<input type="text" class="flat" name="note" value="'.$object->note_private.
'"></td></tr>';
 
  240  if (isModEnabled(
"banque") && (!empty($conf->global->ADHERENT_BANK_USE) || $object->fk_bank)) {
 
  241    print 
'<tr><td>'.$langs->trans(
"BankTransactionLine").
'</td><td class="valeur">';
 
  242    if ($object->fk_bank) {
 
  244      $result = $bankline->fetch($object->fk_bank);
 
  245      print $bankline->getNomUrl(1, 0, 
'showall');
 
  247      print $langs->trans(
"NoneF");
 
  256  print $form->buttonsSaveCancel();
 
  262if ($rowid && $action != 
'edit') {
 
  269  $result = $object->fetch($rowid);
 
  270  $result = $adh->fetch($object->fk_adherent);
 
  274  print 
dol_get_fiche_head($head, 
'general', $langs->trans(
"Subscription"), -1, 
'payment');
 
  277  if ($action == 
'delete') {
 
  278    $formquestion=array();
 
  280    $text = $langs->trans(
"ConfirmDeleteSubscription");
 
  281    if (isModEnabled(
"banque") && !empty($conf->global->ADHERENT_BANK_USE)) {
 
  282      $text .= 
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoDeleteBankRecord");
 
  284    print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"DeleteSubscription"), $text, 
"confirm_delete", $formquestion, 0, 1);
 
  287  print 
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
 
  288  print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  290  $linkback = 
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
 
  294  print 
'<div class="fichecenter">';
 
  296  print 
'<div class="underbanner clearboth"></div>';
 
  298  print 
'<table class="border centpercent tableforfield">';
 
  301  $adh->ref = $adh->getFullName($langs);
 
  303  print 
'<td class="titlefield">'.$langs->trans(
"Member").
'</td><td class="valeur">'.$adh->getNomUrl(-1, 0, 
'subscription').
'</td>';
 
  308  print 
'<td class="titlefield">'.$langs->trans(
"Type").
'</td>';
 
  309  print 
'<td class="valeur">';
 
  310  if ($object->fk_type > 0 || $adh->typeid > 0) {
 
  311    $typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
 
  312    $adht->fetch($typeid);
 
  313    print $adht->getNomUrl(1);
 
  315    print $langs->trans(
"NoType");
 
  321  print 
'<td>'.$langs->trans(
"DateSubscription").
'</td><td class="valeur">'.
dol_print_date($object->dateh, 
'day').
'</td>';
 
  326  print 
'<td>'.$langs->trans(
"DateEndSubscription").
'</td><td class="valeur">'.
dol_print_date($object->datef, 
'day').
'</td>';
 
  330  print 
'<tr><td>'.$langs->trans(
"Amount").
'</td><td class="valeur"><span class="amount">'.
price($object->amount).
'</span></td></tr>';
 
  336  if (isModEnabled(
"banque") && (!empty($conf->global->ADHERENT_BANK_USE) || $object->fk_bank)) {
 
  337    print 
'<tr><td>'.$langs->trans(
"BankTransactionLine").
'</td><td class="valeur">';
 
  338    if ($object->fk_bank) {
 
  340      $result = $bankline->fetch($object->fk_bank);
 
  341      print $bankline->getNomUrl(1, 0, 
'showall');
 
  343      print $langs->trans(
"NoneF");
 
  358  print 
'<div class="tabsAction">';
 
  360  if ($user->hasRight(
'adherent', 
'cotisation', 
'creer')) {
 
  361    if (empty($bankline->rappro) || empty($bankline)) {
 
  362      print 
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id.
'&action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
"</a></div>";
 
  364      print 
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans(
"BankLineConciliated").
'" href="#">'.$langs->trans(
"Modify").
"</a></div>";
 
  369  if ($user->hasRight(
'adherent', 
'cotisation', 
'creer')) {
 
  370    print 
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id.
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
"</a></div>\n";
 
  376  print 
'<div class="fichecenter"><div class="fichehalfleft">';
 
  377  print 
'<a name="builddoc"></a>'; 
 
  392  $somethingshown = $form->showLinkedObjectBlock($object, 
'');
 
  399  print 
'</div><div class="fichehalfright">';
 
  408  print 
'</div></div>';
 
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 transaction lines.
 
Class to manage members of a foundation.
 
Class to manage members type.
 
Class to manage subscriptions of foundation members.
 
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...
 
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_get_fiche_end($notab=0)
Return tab footer of a card.
 
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_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0)
Clean a string to keep only desirable HTML tags.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
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...
 
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
 
subscription_prepare_head(Subscription $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.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.