Go to the documentation of this file.
26 require
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
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');
52 if (!$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'));
76 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
81 if ($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) {
144 if ($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);
163 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
170 if ($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" colspan="3">';
198 print
$form->showrefnav($object,
'rowid', $linkback, 1);
202 $adh->ref = $adh->getFullName($langs);
204 print
'<td>'.$langs->trans(
"Member").
'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1, 0,
'subscription').
'</td>';
209 print
'<td>'.$langs->trans(
"Type").
'</td><td class="valeur" colspan="3">';
210 print
$form->selectarray(
"typeid", $adht->liste_array(), (
GETPOSTISSET(
"typeid") ?
GETPOST(
"typeid") : $object->fk_type));
214 print
'<tr><td>'.$langs->trans(
"DateSubscription").
'</td><td class="valeur" colspan="2">';
215 print
$form->selectDate($object->dateh,
'datesub', 1, 1, 0,
'update', 1);
220 print
'<tr><td>'.$langs->trans(
"DateEndSubscription").
'</td><td class="valeur" colspan="2">';
221 print
$form->selectDate($object->datef,
'datesubend', 0, 0, 0,
'update', 1);
226 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td class="valeur" colspan="2">';
227 print
'<input type="text" class="flat" size="10" name="amount" value="'.price($object->amount).
'"></td></tr>';
230 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td class="valeur" colspan="2">';
231 print
'<input type="text" class="flat" size="60" name="note" value="'.$object->note.
'"></td></tr>';
234 if (
isModEnabled(
"banque") && (!empty($conf->global->ADHERENT_BANK_USE) || $object->fk_bank)) {
235 print
'<tr><td>'.$langs->trans(
"BankTransactionLine").
'</td><td class="valeur" colspan="2">';
236 if ($object->fk_bank) {
238 $result = $bankline->fetch($object->fk_bank);
239 print $bankline->getNomUrl(1, 0,
'showall');
241 print $langs->trans(
"NoneF");
250 print
$form->buttonsSaveCancel();
256 if ($rowid && $action !=
'edit') {
263 $result = $object->fetch($rowid);
264 $result = $adh->fetch($object->fk_adherent);
268 print
dol_get_fiche_head($head,
'general', $langs->trans(
"Subscription"), -1,
'payment');
271 if ($action ==
'delete') {
272 $formquestion=array();
274 $text = $langs->trans(
"ConfirmDeleteSubscription");
275 if (
isModEnabled(
"banque") && !empty($conf->global->ADHERENT_BANK_USE)) {
276 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoDeleteBankRecord");
278 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"DeleteSubscription"), $text,
"confirm_delete", $formquestion, 0, 1);
281 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
282 print
'<input type="hidden" name="token" value="'.newToken().
'">';
284 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
288 print
'<div class="fichecenter">';
290 print
'<div class="underbanner clearboth"></div>';
292 print
'<table class="border centpercent tableforfield">';
295 $adh->ref = $adh->getFullName($langs);
297 print
'<td class="titlefield">'.$langs->trans(
"Member").
'</td><td class="valeur">'.$adh->getNomUrl(1, 0,
'subscription').
'</td>';
302 print
'<td class="titlefield">'.$langs->trans(
"Type").
'</td>';
303 print
'<td class="valeur">';
304 if ($object->fk_type > 0 || $adh->typeid > 0) {
305 $typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
306 $adht->fetch($typeid);
307 print $adht->getNomUrl(1);
309 print $langs->trans(
"NoType");
315 print
'<td>'.$langs->trans(
"DateSubscription").
'</td><td class="valeur">'.
dol_print_date($object->dateh,
'day').
'</td>';
320 print
'<td>'.$langs->trans(
"DateEndSubscription").
'</td><td class="valeur">'.
dol_print_date($object->datef,
'day').
'</td>';
324 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td class="valeur"><span class="amount">'.
price($object->amount).
'</span></td></tr>';
327 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td class="valeur">'.$object->note.
'</td></tr>';
330 if (
isModEnabled(
"banque") && (!empty($conf->global->ADHERENT_BANK_USE) || $object->fk_bank)) {
331 print
'<tr><td>'.$langs->trans(
"BankTransactionLine").
'</td><td class="valeur">';
332 if ($object->fk_bank) {
334 $result = $bankline->fetch($object->fk_bank);
335 print $bankline->getNomUrl(1, 0,
'showall');
337 print $langs->trans(
"NoneF");
352 print
'<div class="tabsAction">';
354 if ($user->hasRight(
'adherent',
'cotisation',
'creer')) {
355 if (!empty($bankline->rappro)) {
356 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>";
358 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans(
"BankLineConciliated").
"\" href=\"#\">".$langs->trans(
"Modify").
"</a></div>";
363 if ($user->hasRight(
'adherent',
'cotisation',
'creer')) {
364 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";
370 print
'<div class="fichecenter"><div class="fichehalfleft">';
371 print
'<a name="builddoc"></a>';
386 $somethingshown =
$form->showLinkedObjectBlock($object,
'');
393 print
'</div><div class="fichehalfright">';
402 print
'</div></div>';
Class to manage members type.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
subscription_prepare_head(Subscription $object)
Return array head with list of tabs to view object informations.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage subscriptions of foundation members.
Class to manage members of a foundation.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
isModEnabled($module)
Is Dolibarr module enabled.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Class to manage bank transaction lines.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
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...