25 require
'../../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
30 if (!empty($conf->banque->enabled)) {
31 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
35 $langs->loadLangs(array(
"companies",
"members",
"bills",
"users"));
42 $action =
GETPOST(
"action",
'alpha');
44 $typeid =
GETPOST(
"typeid",
"int");
45 $cancel =
GETPOST(
'cancel',
'alpha');
47 $note =
GETPOST(
'note',
'alpha');
48 $typeid = (int)
GETPOST(
'typeid',
'int');
51 if (empty($user->rights->adherent->cotisation->lire)) {
55 $permissionnote = $user->rights->adherent->cotisation->creer;
56 $permissiondellink = $user->rights->adherent->cotisation->creer;
57 $permissiontoedit = $user->rights->adherent->cotisation->creer;
59 $hookmanager->initHooks(array(
'subscriptioncard',
'globalcard'));
75 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
80 if ($user->rights->adherent->cotisation->creer && $action ==
'update' && !$cancel) {
82 $result = $object->fetch($rowid);
88 if ($object->fk_bank) {
90 $result = $accountline->fetch($object->fk_bank);
93 if ($accountline->rappro) {
94 $errmsg = $langs->trans(
"SubscriptionLinkedToConciliatedTransaction");
96 $accountline->datev =
dol_mktime(
GETPOST(
'datesubhour',
'int'),
GETPOST(
'datesubmin',
'int'), 0,
GETPOST(
'datesubmonth',
'int'),
GETPOST(
'datesubday',
'int'),
GETPOST(
'datesubyear',
'int'));
97 $accountline->dateo =
dol_mktime(
GETPOST(
'datesubhour',
'int'),
GETPOST(
'datesubmin',
'int'), 0,
GETPOST(
'datesubmonth',
'int'),
GETPOST(
'datesubday',
'int'),
GETPOST(
'datesubyear',
'int'));
98 $accountline->amount = $amount;
99 $result = $accountline->update($user);
101 $errmsg = $accountline->error;
108 $object->dateh =
dol_mktime(
GETPOST(
'datesubhour',
'int'),
GETPOST(
'datesubmin',
'int'), 0,
GETPOST(
'datesubmonth',
'int'),
GETPOST(
'datesubday',
'int'),
GETPOST(
'datesubyear',
'int'));
109 $object->datef =
dol_mktime(
GETPOST(
'datesubendhour',
'int'),
GETPOST(
'datesubendmin',
'int'), 0,
GETPOST(
'datesubendmonth',
'int'),
GETPOST(
'datesubendday',
'int'),
GETPOST(
'datesubendyear',
'int'));
110 $object->fk_type = $typeid;
111 $object->note = $note;
112 $object->note_private = $note;
113 $object->amount = $amount;
115 $result = $object->update($user);
116 if ($result >= 0 && !count($object->errors)) {
119 header(
"Location: card.php?rowid=".$object->id);
124 if ($object->error) {
125 $errmsg = $object->error;
127 foreach ($object->errors as $error) {
142 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->rights->adherent->cotisation->creer) {
143 $result = $object->fetch($rowid);
144 $result = $object->delete($user);
146 header(
"Location: ".DOL_URL_ROOT.
"/adherents/card.php?rowid=".$object->fk_adherent);
161 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
168 if ($user->rights->adherent->cotisation->creer && $action ==
'edit') {
175 $object->fetch($rowid);
176 $result = $adh->fetch($object->fk_adherent);
180 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
181 print
'<input type="hidden" name="token" value="'.newToken().
'">';
182 print
"<input type=\"hidden\" name=\"action\" value=\"update\">";
183 print
"<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
184 print
"<input type=\"hidden\" name=\"fk_bank\" value=\"".$object->fk_bank.
"\">";
186 print
dol_get_fiche_head($head,
'general', $langs->trans(
"Subscription"), 0,
'payment');
188 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
191 print
'<table class="border centpercent">';
194 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
195 print
'<td class="valeur" colspan="3">';
196 print
$form->showrefnav($object,
'rowid', $linkback, 1);
200 $adh->ref = $adh->getFullName($langs);
202 print
'<td>'.$langs->trans(
"Member").
'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1, 0,
'subscription').
'</td>';
207 print
'<td>'.$langs->trans(
"Type").
'</td><td class="valeur" colspan="3">';
208 print
$form->selectarray(
"typeid", $adht->liste_array(), (
GETPOSTISSET(
"typeid") ?
GETPOST(
"typeid") : $object->fk_type));
212 print
'<tr><td>'.$langs->trans(
"DateSubscription").
'</td><td class="valeur" colspan="2">';
213 print
$form->selectDate($object->dateh,
'datesub', 1, 1, 0,
'update', 1);
218 print
'<tr><td>'.$langs->trans(
"DateEndSubscription").
'</td><td class="valeur" colspan="2">';
219 print
$form->selectDate($object->datef,
'datesubend', 0, 0, 0,
'update', 1);
224 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td class="valeur" colspan="2">';
225 print
'<input type="text" class="flat" size="10" name="amount" value="'.price($object->amount).
'"></td></tr>';
228 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td class="valeur" colspan="2">';
229 print
'<input type="text" class="flat" size="60" name="note" value="'.$object->note.
'"></td></tr>';
232 if (!empty($conf->banque->enabled) && ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)) {
233 print
'<tr><td>'.$langs->trans(
"BankTransactionLine").
'</td><td class="valeur" colspan="2">';
234 if ($object->fk_bank) {
236 $result = $bankline->fetch($object->fk_bank);
237 print $bankline->getNomUrl(1, 0,
'showall');
239 print $langs->trans(
"NoneF");
248 print
$form->buttonsSaveCancel();
254 if ($rowid && $action !=
'edit') {
261 $result = $object->fetch($rowid);
262 $result = $adh->fetch($object->fk_adherent);
266 print
dol_get_fiche_head($head,
'general', $langs->trans(
"Subscription"), -1,
'payment');
269 if ($action ==
'delete') {
272 $text = $langs->trans(
"ConfirmDeleteSubscription");
273 if (!empty($conf->banque->enabled) && !empty($conf->global->ADHERENT_BANK_USE)) {
274 $text .=
'<br>'.img_warning().
' '.$langs->trans(
"ThisWillAlsoDeleteBankRecord");
276 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?rowid=".$object->id, $langs->trans(
"DeleteSubscription"), $text,
"confirm_delete", $formquestion, 0, 1);
279 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
280 print
'<input type="hidden" name="token" value="'.newToken().
'">';
282 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
286 print
'<div class="fichecenter">';
288 print
'<div class="underbanner clearboth"></div>';
290 print
'<table class="border centpercent">';
293 $adh->ref = $adh->getFullName($langs);
295 print
'<td class="titlefield">'.$langs->trans(
"Member").
'</td><td class="valeur">'.$adh->getNomUrl(1, 0,
'subscription').
'</td>';
300 print
'<td class="titlefield">'.$langs->trans(
"Type").
'</td>';
301 print
'<td class="valeur">';
302 if ($object->fk_type > 0 || $adh->typeid > 0) {
303 $typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
304 $adht->fetch($typeid);
305 print $adht->getNomUrl(1);
307 print $langs->trans(
"NoType");
313 print
'<td>'.$langs->trans(
"DateSubscription").
'</td><td class="valeur">'.
dol_print_date($object->dateh,
'day').
'</td>';
318 print
'<td>'.$langs->trans(
"DateEndSubscription").
'</td><td class="valeur">'.
dol_print_date($object->datef,
'day').
'</td>';
322 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td class="valeur">'.
price($object->amount).
'</td></tr>';
325 print
'<tr><td>'.$langs->trans(
"Label").
'</td><td class="valeur">'.$object->note.
'</td></tr>';
328 if (!empty($conf->banque->enabled) && ($conf->global->ADHERENT_BANK_USE || $object->fk_bank)) {
329 print
'<tr><td>'.$langs->trans(
"BankTransactionLine").
'</td><td class="valeur">';
330 if ($object->fk_bank) {
332 $result = $bankline->fetch($object->fk_bank);
333 print $bankline->getNomUrl(1, 0,
'showall');
335 print $langs->trans(
"NoneF");
350 print
'<div class="tabsAction">';
352 if ($user->rights->adherent->cotisation->creer) {
353 if (!$bankline->rappro) {
354 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>";
356 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.$langs->trans(
"BankLineConciliated").
"\" href=\"#\">".$langs->trans(
"Modify").
"</a></div>";
361 if ($user->rights->adherent->cotisation->creer) {
362 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";
368 print
'<div class="fichecenter"><div class="fichehalfleft">';
369 print
'<a name="builddoc"></a>';
384 $somethingshown =
$form->showLinkedObjectBlock($object,
'');
391 print
'</div><div class="fichehalfright">';
400 print
'</div></div>';
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_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...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank transaction lines.
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.
subscription_prepare_head(Subscription $object)
Return array head with list of tabs to view object informations.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
Class to manage members of a foundation.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage members type.
restrictedArea($user, $features, $objectid=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.
Class to manage subscriptions of foundation members.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
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_htmloutput_errors($mesgstring= '', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).