30require
'../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/loan.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34if (isModEnabled(
'accounting')) {
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
37if (isModEnabled(
'accounting')) {
38 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
45$langs->loadLangs(array(
"compta",
"bills",
"loan"));
48$action =
GETPOST(
'action',
'aZ09');
50$cancel =
GETPOST(
'cancel',
'alpha');
52$projectid =
GETPOST(
'projectid',
'int');
55$socid =
GETPOST(
'socid',
'int');
57 $socid = $user->socid;
61$object =
new Loan($db);
63$hookmanager->initHooks(array(
'loancard',
'globalcard'));
73$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
79 if ($action ==
'confirm_paid' && $confirm ==
'yes' && $user->hasRight(
'loan',
'write')) {
81 $result = $object->setPaid($user);
90 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'loan',
'write')) {
92 $result = $object->delete($user);
95 header(
"Location: list.php");
103 if ($action ==
'add' && $user->hasRight(
'loan',
'write')) {
111 $error++; $action =
'create';
112 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"LoanCapital")),
null,
'errors');
115 $error++; $action =
'create';
116 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DateStart")),
null,
'errors');
119 $error++; $action =
'create';
120 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DateEnd")),
null,
'errors');
123 $error++; $action =
'create';
124 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rate")),
null,
'errors');
128 $object->label =
GETPOST(
'label');
129 $object->fk_bank =
GETPOST(
'accountid');
130 $object->capital = $capital;
131 $object->datestart = $datestart;
132 $object->dateend = $dateend;
133 $object->nbterm =
GETPOST(
'nbterm');
134 $object->rate = $rate;
135 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
136 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
137 $object->fk_project =
GETPOST(
'projectid',
'int');
138 $object->insurance_amount =
GETPOST(
'insurance_amount',
'int');
140 $accountancy_account_capital =
GETPOST(
'accountancy_account_capital');
141 $accountancy_account_insurance =
GETPOST(
'accountancy_account_insurance');
142 $accountancy_account_interest =
GETPOST(
'accountancy_account_interest');
144 if ($accountancy_account_capital <= 0) {
145 $object->account_capital =
'';
147 $object->account_capital = $accountancy_account_capital;
149 if ($accountancy_account_insurance <= 0) {
150 $object->account_insurance =
'';
152 $object->account_insurance = $accountancy_account_insurance;
154 if ($accountancy_account_interest <= 0) {
155 $object->account_interest =
'';
157 $object->account_interest = $accountancy_account_interest;
160 $id = $object->create($user);
168 header(
"Location: list.php");
171 } elseif ($action ==
'update' && $user->hasRight(
'loan',
'write')) {
174 $result = $object->fetch($id);
181 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"LoanCapital")),
null,
'errors');
184 $object->datestart = $datestart;
185 $object->dateend = $dateend;
186 $object->capital = $capital;
187 $object->nbterm =
GETPOST(
"nbterm",
'int');
191 $accountancy_account_capital =
GETPOST(
'accountancy_account_capital');
192 $accountancy_account_insurance =
GETPOST(
'accountancy_account_insurance');
193 $accountancy_account_interest =
GETPOST(
'accountancy_account_interest');
195 if ($accountancy_account_capital <= 0) {
196 $object->account_capital =
'';
198 $object->account_capital = $accountancy_account_capital;
200 if ($accountancy_account_insurance <= 0) {
201 $object->account_insurance =
'';
203 $object->account_insurance = $accountancy_account_insurance;
205 if ($accountancy_account_interest <= 0) {
206 $object->account_interest =
'';
208 $object->account_interest = $accountancy_account_interest;
212 $result = $object->update($user);
215 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
222 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
228 if ($action ==
'classin' && $user->hasRight(
'loan',
'write')) {
230 $result = $object->setProject($projectid);
236 if ($action ==
'setlabel' && $user->hasRight(
'loan',
'write')) {
238 $result = $object->setValueFrom(
'label',
GETPOST(
'label'),
'',
'',
'text',
'', $user,
'LOAN_MODIFY');
250$form =
new Form($db);
253$outputlangs = $langs;
254if (isModEnabled(
'accounting')) {
258$title = $langs->trans(
"Loan").
' - '.$langs->trans(
"Card");
259$help_url =
'EN:Module_Loan|FR:Module_Emprunt';
264if ($action ==
'create') {
266 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
272 print
'<form name="loan" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
273 print
'<input type="hidden" name="token" value="'.newToken().
'">';
274 print
'<input type="hidden" name="action" value="add">';
278 print
'<table class="border centpercent">';
281 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Label").
'</td><td><input name="label" class="minwidth300" maxlength="255" value="'.
dol_escape_htmltag(
GETPOST(
'label')).
'" autofocus="autofocus"></td></tr>';
284 if (isModEnabled(
"banque")) {
285 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Account").
'</td><td>';
286 $form->select_comptes(
GETPOST(
"accountid"),
"accountid", 0,
"courant=1", 1);
289 print
'<tr><td>'.$langs->trans(
"Account").
'</td><td>';
290 print $langs->trans(
"NoBankAccountDefined");
295 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanCapital").
'</td><td><input name="capital" size="10" value="'.
dol_escape_htmltag(
GETPOST(
"capital")).
'"></td></tr>';
299 print
'<td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
300 print $form->selectDate(!empty($datestart) ? $datestart : -1,
'start',
'',
'',
'',
'add', 1, 1);
305 print
'<td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
306 print $form->selectDate(!empty($dateend) ? $dateend : -1,
'end',
'',
'',
'',
'add', 1, 1);
310 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Nbterms").
'</td><td><input name="nbterm" size="5" value="'.
dol_escape_htmltag(
GETPOST(
'nbterm')).
'"></td></tr>';
313 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Rate").
'</td><td><input name="rate" size="5" value="'.
dol_escape_htmltag(
GETPOST(
"rate")).
'"> %</td></tr>';
316 print
'<tr><td>'.$langs->trans(
"Insurance").
'</td><td><input name="insurance_amount" size="10" value="'.
dol_escape_htmltag(
GETPOST(
"insurance_amount")).
'" placeholder="'.$langs->trans(
'Amount').
'"></td></tr>';
319 if (isModEnabled(
'project')) {
323 $langs->loadLangs(array(
"projects"));
325 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
327 $numproject = $formproject->select_projects(-1, $projectid,
'projectid', 16, 0, 1, 1);
334 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
337 $doleditor =
new DolEditor(
'note_private',
GETPOST(
'note_private',
'alpha'),
'', 160,
'dolibarr_notes',
'In',
false,
true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_6,
'90%');
338 print $doleditor->Create(1);
344 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
346 $doleditor =
new DolEditor(
'note_public',
GETPOST(
'note_public',
'alpha'),
'', 160,
'dolibarr_notes',
'In',
false,
true, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_6,
'90%');
347 print $doleditor->Create(1);
351 if (isModEnabled(
'accounting')) {
353 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"LoanAccountancyCapitalCode").
'</td>';
355 print $formaccounting->select_account(
GETPOST(
'accountancy_account_capital') ?
GETPOST(
'accountancy_account_capital') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL'),
'accountancy_account_capital', 1,
'', 1, 1);
359 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanAccountancyInsuranceCode").
'</td>';
361 print $formaccounting->select_account(
GETPOST(
'accountancy_account_insurance') ?
GETPOST(
'accountancy_account_insurance') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'),
'accountancy_account_insurance', 1,
'', 1, 1);
365 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanAccountancyInterestCode").
'</td>';
367 print $formaccounting->select_account(
GETPOST(
'accountancy_account_interest') ?
GETPOST(
'accountancy_account_interest') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_INTEREST'),
'accountancy_account_interest', 1,
'', 1, 1);
372 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"LoanAccountancyCapitalCode").
'</td>';
373 print
'<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.
'">';
377 print
'<tr><td>'.$langs->trans(
"LoanAccountancyInsuranceCode").
'</td>';
378 print
'<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.
'">';
382 print
'<tr><td>'.$langs->trans(
"LoanAccountancyInterestCode").
'</td>';
383 print
'<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.
'">';
390 print $form->buttonsSaveCancel(
"Add");
397 $object =
new Loan($db);
398 $result = $object->fetch($id);
403 $totalpaid = $object->getSumPayment();
406 if ($action ==
'paid') {
407 $text = $langs->trans(
'ConfirmPayLoan');
408 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayLoan'), $text,
"confirm_paid",
'',
'', 2);
411 if ($action ==
'delete') {
412 $text = $langs->trans(
'ConfirmDeleteLoan');
413 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteLoan'), $text,
'confirm_delete',
'',
'', 2);
416 if ($action ==
'edit') {
417 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
418 print
'<input type="hidden" name="token" value="'.newToken().
'">';
419 print
'<input type="hidden" name="action" value="update">';
420 print
'<input type="hidden" name="id" value="'.$id.
'">';
427 $linkback =
'<a href="'.DOL_URL_ROOT.
'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
429 $morehtmlref =
'<div class="refidno">';
431 $morehtmlref .= $form->editfieldkey(
"Label",
'label', $object->label, $object, $user->hasRight(
'loan',
'write'),
'string',
'', 0, 1);
432 $morehtmlref .= $form->editfieldval(
"Label",
'label', $object->label, $object, $user->hasRight(
'loan',
'write'),
'string',
'',
null,
null,
'', 1);
434 if (isModEnabled(
'project')) {
435 $langs->loadLangs(array(
"projects"));
436 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
437 if ($user->hasRight(
'loan',
'write')) {
438 if ($action !=
'classify') {
439 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
441 if ($action ==
'classify') {
443 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
444 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
445 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
446 $morehtmlref .= $formproject->select_projects(-1, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
447 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
448 $morehtmlref .=
'</form>';
450 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, -1, $object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
453 if (!empty($object->fk_project)) {
455 $proj->fetch($object->fk_project);
456 $morehtmlref .=
' : '.$proj->getNomUrl(1);
458 $morehtmlref .=
' - '.$proj->title;
465 $morehtmlref .=
'</div>';
467 $object->totalpaid = $totalpaid;
469 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
471 print
'<div class="fichecenter">';
472 print
'<div class="fichehalfleft">';
473 print
'<div class="underbanner clearboth"></div>';
475 print
'<table class="border centpercent tableforfield">';
478 if ($action ==
'edit') {
479 print
'<tr><td class="fieldrequired titlefield">'.$langs->trans(
"LoanCapital").
'</td><td>';
480 print
'<input name="capital" size="10" value="'.$object->capital.
'"></td></tr>';
483 print
'<tr><td class="titlefield">'.$langs->trans(
"LoanCapital").
'</td><td><span class="amount">'.
price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).
'</span></td></tr>';
487 if ($action ==
'edit') {
488 print
'<tr><td class="titlefield">'.$langs->trans(
"Insurance").
'</td><td>';
489 print
'<input name="insurance_amount" size="10" value="'.$object->insurance_amount.
'"></td></tr>';
492 print
'<tr><td class="titlefield">'.$langs->trans(
"Insurance").
'</td><td><span class="amount">'.
price($object->insurance_amount, 0, $outputlangs, 1, -1, -1, $conf->currency).
'</span></td></tr>';
496 print
'<tr><td>'.$langs->trans(
"DateStart").
"</td>";
498 if ($action ==
'edit') {
499 print $form->selectDate($object->datestart,
'start', 0, 0, 0,
'update', 1, 0);
506 print
'<tr><td>'.$langs->trans(
"DateEnd").
"</td>";
508 if ($action ==
'edit') {
509 print $form->selectDate($object->dateend,
'end', 0, 0, 0,
'update', 1, 0);
516 print
'<tr><td>'.$langs->trans(
"Nbterms").
'</td>';
518 if ($action ==
'edit') {
519 print
'<input name="nbterm" size="4" value="'.$object->nbterm.
'">';
521 print $object->nbterm;
526 print
'<tr><td>'.$langs->trans(
"Rate").
'</td>';
528 if ($action ==
'edit') {
529 print
'<input name="rate" size="4" value="'.$object->rate.
'">%';
531 print
price($object->rate).
'%';
537 if ($action ==
'edit') {
538 print
'<td class="nowrap fieldrequired">';
539 print $langs->trans(
"LoanAccountancyCapitalCode");
542 if (isModEnabled(
'accounting')) {
543 print $formaccounting->select_account($object->account_capital,
'accountancy_account_capital', 1,
'', 1, 1);
545 print
'<input name="accountancy_account_capital" size="16" value="'.$object->account_capital.
'">';
549 print
'<td class="nowrap">';
550 print $langs->trans(
"LoanAccountancyCapitalCode");
553 if (isModEnabled(
'accounting')) {
555 $accountingaccount->fetch(
'', $object->account_capital, 1);
557 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
559 print $object->account_capital;
568 if ($action ==
'edit') {
569 print
'<td class="nowrap fieldrequired">';
570 print $langs->trans(
"LoanAccountancyInsuranceCode");
573 if (isModEnabled(
'accounting')) {
574 print $formaccounting->select_account($object->account_insurance,
'accountancy_account_insurance', 1,
'', 1, 1);
576 print
'<input name="accountancy_account_insurance" size="16" value="'.$object->account_insurance.
'">';
580 print
'<td class="nowrap">';
581 print $langs->trans(
"LoanAccountancyInsuranceCode");
584 if (isModEnabled(
'accounting')) {
586 $accountingaccount->fetch(
'', $object->account_insurance, 1);
588 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
590 print $object->account_insurance;
599 if ($action ==
'edit') {
600 print
'<td class="nowrap fieldrequired">';
601 print $langs->trans(
"LoanAccountancyInterestCode");
604 if (isModEnabled(
'accounting')) {
605 print $formaccounting->select_account($object->account_interest,
'accountancy_account_interest', 1,
'', 1, 1);
607 print
'<input name="accountancy_account_interest" size="16" value="'.$object->account_interest.
'">';
611 print
'<td class="nowrap">';
612 print $langs->trans(
"LoanAccountancyInterestCode");
615 if (isModEnabled(
'accounting')) {
617 $accountingaccount->fetch(
'', $object->account_interest, 1);
619 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
621 print $object->account_interest;
629 $parameters = array();
630 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
631 print $hookmanager->resPrint;
636 print
'<div class="fichehalfright">';
641 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp,";
642 $sql .=
" p.amount_capital, p.amount_insurance, p.amount_interest,";
643 $sql .=
" b.fk_account,";
644 $sql .=
" c.libelle as paiement_type";
645 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_loan as p";
646 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON p.fk_bank = b.rowid";
647 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepayment = c.id,";
648 $sql .=
" ".MAIN_DB_PREFIX.
"loan as l";
649 $sql .=
" WHERE p.fk_loan = ".((int) $id);
650 $sql .=
" AND p.fk_loan = l.rowid";
651 $sql .=
" AND l.entity IN ( ".getEntity(
'loan').
")";
652 $sql .=
" ORDER BY dp DESC";
655 $resql = $db->query($sql);
657 $num = $db->num_rows($resql);
659 $total_insurance = 0;
663 print
'<div class="div-table-responsive-no-min">';
664 print
'<table class="noborder paymenttable">';
665 print
'<tr class="liste_titre">';
666 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
667 print
'<td>'.$langs->trans(
"Date").
'</td>';
668 print
'<td>'.$langs->trans(
"Type").
'</td>';
669 print
'<td>'.$langs->trans(
"BankAccount").
'</td>';
670 print
'<td class="right">'.$langs->trans(
"Insurance").
'</td>';
671 print
'<td class="right">'.$langs->trans(
"Interest").
'</td>';
672 print
'<td class="right">'.$langs->trans(
"LoanCapital").
'</td>';
675 $conf->cache[
'bankaccount'] = array();
678 $objp = $db->fetch_object($resql);
680 print
'<tr class="oddeven">';
681 print
'<td><a href="'.DOL_URL_ROOT.
'/loan/payment/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
682 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
683 print
"<td>".$objp->paiement_type.
' '.$objp->num_payment.
"</td>\n";
685 if (!empty($conf->cache[
'bankaccount'][$objp->fk_account])) {
686 $tmpbank = $conf->cache[
'bankaccount'][$objp->fk_account];
689 $tmpbank->fetch($objp->fk_account);
690 $conf->cache[
'bankaccount'][$objp->fk_account] = $tmpbank;
692 print $tmpbank->getNomUrl(1);
694 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency).
"</span></td>\n";
695 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency).
"</span></td>\n";
696 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency).
"</span></td>\n";
698 $total_capital += $objp->amount_capital;
702 $totalpaid = $total_capital;
704 if ($object->paid == 0 || $object->paid == 2) {
705 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="nowrap right">'.
price($totalpaid, 0, $langs, 0, -1, -1, $conf->currency).
'</td></tr>';
706 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="nowrap right">'.
price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).
'</td></tr>';
708 $staytopay = $object->capital - $totalpaid;
710 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"RemainderToPay").
' :</td>';
711 print
'<td class="nowrap right'.($staytopay ?
' amountremaintopay' :
' amountpaymentcomplete').
'">';
712 print
price($staytopay, 0, $langs, 0, -1, -1, $conf->currency);
726 print
'<div class="clearboth"></div>';
730 if ($action ==
'edit') {
731 print $form->buttonsSaveCancel();
739 if ($action !=
'edit') {
740 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
741 if (empty($reshook)) {
742 print
'<div class="tabsAction">';
745 if (($object->paid == 0 || $object->paid == 2) && $user->hasRight(
'loan',
'write')) {
746 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/loan/card.php?id='.$object->id.
'&action=edit&token='.newToken().
'">'.$langs->trans(
"Modify").
'</a></div>';
750 if (($object->paid == 0 || $object->paid == 2) && ((
price2num($object->capital) > 0 && round($staytopay) < 0) || (
price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->hasRight(
'loan',
'write')) {
751 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/loan/payment/payment.php?id='.$object->id.
'&action=create&token='.newToken().
'">'.$langs->trans(
"DoPayment").
'</a></div>';
755 if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->hasRight(
'loan',
'write')) {
756 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/loan/card.php?id='.$object->id.
'&action=paid&token='.newToken().
'">'.$langs->trans(
"ClassifyPaid").
'</a></div>';
760 if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->delete) {
761 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.
'/loan/card.php?id='.$object->id.
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
'</a></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 accounts.
Class to manage accounting accounts.
Class to manage a WYSIWYG editor.
Class to manage projects.
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...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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).
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
loan_prepare_head($object)
Prepare array with list of tabs.
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.