28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/loan.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/loan/class/loan.class.php';
36if (isModEnabled(
'accounting')) {
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
41if (isModEnabled(
'project')) {
42 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
47$langs->loadLangs(array(
"bills",
"compta",
"loan"));
50$action =
GETPOST(
'action',
'aZ09');
52$cancel =
GETPOST(
'cancel',
'alpha');
54$projectid =
GETPOST(
'projectid',
'int');
57$socid =
GETPOST(
'socid',
'int');
59 $socid = $user->socid;
63$object =
new Loan($db);
65$hookmanager->initHooks(array(
'loancard',
'globalcard'));
75$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
81 if ($action ==
'confirm_paid' && $confirm ==
'yes' && $user->hasRight(
'loan',
'write')) {
83 $result = $object->setPaid($user);
92 if ($action ==
'confirm_delete' && $confirm ==
'yes' && $user->hasRight(
'loan',
'write')) {
94 $result = $object->delete($user);
97 header(
"Location: list.php");
105 if ($action ==
'add' && $user->hasRight(
'loan',
'write')) {
115 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"LoanCapital")),
null,
'errors');
120 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DateStart")),
null,
'errors');
125 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"DateEnd")),
null,
'errors');
130 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Rate")),
null,
'errors');
134 $object->label =
GETPOST(
'label');
135 $object->fk_bank =
GETPOST(
'accountid');
136 $object->capital = $capital;
137 $object->datestart = $datestart;
138 $object->dateend = $dateend;
139 $object->nbterm =
GETPOST(
'nbterm');
140 $object->rate = $rate;
141 $object->note_private =
GETPOST(
'note_private',
'restricthtml');
142 $object->note_public =
GETPOST(
'note_public',
'restricthtml');
143 $object->fk_project =
GETPOST(
'projectid',
'int');
144 $object->insurance_amount =
GETPOST(
'insurance_amount',
'int');
146 $accountancy_account_capital =
GETPOST(
'accountancy_account_capital');
147 $accountancy_account_insurance =
GETPOST(
'accountancy_account_insurance');
148 $accountancy_account_interest =
GETPOST(
'accountancy_account_interest');
150 if ($accountancy_account_capital <= 0) {
151 $object->account_capital =
'';
153 $object->account_capital = $accountancy_account_capital;
155 if ($accountancy_account_insurance <= 0) {
156 $object->account_insurance =
'';
158 $object->account_insurance = $accountancy_account_insurance;
160 if ($accountancy_account_interest <= 0) {
161 $object->account_interest =
'';
163 $object->account_interest = $accountancy_account_interest;
166 $id = $object->create($user);
174 header(
"Location: list.php");
177 } elseif ($action ==
'update' && $user->hasRight(
'loan',
'write')) {
180 $result = $object->fetch($id);
187 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"LoanCapital")),
null,
'errors');
190 $object->datestart = $datestart;
191 $object->dateend = $dateend;
192 $object->capital = $capital;
193 $object->nbterm =
GETPOST(
"nbterm",
'int');
197 $accountancy_account_capital =
GETPOST(
'accountancy_account_capital');
198 $accountancy_account_insurance =
GETPOST(
'accountancy_account_insurance');
199 $accountancy_account_interest =
GETPOST(
'accountancy_account_interest');
201 if ($accountancy_account_capital <= 0) {
202 $object->account_capital =
'';
204 $object->account_capital = $accountancy_account_capital;
206 if ($accountancy_account_insurance <= 0) {
207 $object->account_insurance =
'';
209 $object->account_insurance = $accountancy_account_insurance;
211 if ($accountancy_account_interest <= 0) {
212 $object->account_interest =
'';
214 $object->account_interest = $accountancy_account_interest;
218 $result = $object->update($user);
221 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
228 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
234 if ($action ==
'classin' && $user->hasRight(
'loan',
'write')) {
236 $result = $object->setProject($projectid);
242 if ($action ==
'setlabel' && $user->hasRight(
'loan',
'write')) {
244 $result = $object->setValueFrom(
'label',
GETPOST(
'label'),
'',
'',
'text',
'', $user,
'LOAN_MODIFY');
251 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
259$form =
new Form($db);
262$outputlangs = $langs;
263if (isModEnabled(
'accounting')) {
267$title = $langs->trans(
"Loan").
' - '.$langs->trans(
"Card");
268$help_url =
'EN:Module_Loan|FR:Module_Emprunt';
273if ($action ==
'create') {
275 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
281 print
'<form name="loan" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
282 print
'<input type="hidden" name="token" value="'.newToken().
'">';
283 print
'<input type="hidden" name="action" value="add">';
287 print
'<table class="border centpercent">';
290 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>';
293 if (isModEnabled(
"banque")) {
294 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Account").
'</td><td>';
295 $form->select_comptes(
GETPOST(
"accountid"),
"accountid", 0,
"courant=1", 1);
298 print
'<tr><td>'.$langs->trans(
"Account").
'</td><td>';
299 print $langs->trans(
"NoBankAccountDefined");
304 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanCapital").
'</td><td><input name="capital" size="10" value="'.
dol_escape_htmltag(
GETPOST(
"capital")).
'"></td></tr>';
308 print
'<td class="fieldrequired">'.$langs->trans(
"DateStart").
'</td><td>';
309 print $form->selectDate(!empty($datestart) ? $datestart : -1,
'start',
'',
'',
'',
'add', 1, 1);
314 print
'<td class="fieldrequired">'.$langs->trans(
"DateEnd").
'</td><td>';
315 print $form->selectDate(!empty($dateend) ? $dateend : -1,
'end',
'',
'',
'',
'add', 1, 1);
319 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Nbterms").
'</td><td><input name="nbterm" size="5" value="'.
dol_escape_htmltag(
GETPOST(
'nbterm')).
'"></td></tr>';
322 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Rate").
'</td><td><input name="rate" size="5" value="'.
dol_escape_htmltag(
GETPOST(
"rate")).
'"> %</td></tr>';
325 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>';
328 if (isModEnabled(
'project')) {
332 $langs->loadLangs(array(
"projects"));
334 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
336 $numproject = $formproject->select_projects(-1, $projectid,
'projectid', 16, 0, 1, 1);
343 print
'<td class="tdtop">'.$langs->trans(
'NotePrivate').
'</td>';
346 $doleditor =
new DolEditor(
'note_private',
GETPOST(
'note_private',
'alpha'),
'', 160,
'dolibarr_notes',
'In',
false,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_6,
'90%');
347 print $doleditor->Create(1);
353 print
'<td class="tdtop">'.$langs->trans(
'NotePublic').
'</td>';
355 $doleditor =
new DolEditor(
'note_public',
GETPOST(
'note_public',
'alpha'),
'', 160,
'dolibarr_notes',
'In',
false,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_6,
'90%');
356 print $doleditor->Create(1);
360 if (isModEnabled(
'accounting')) {
362 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"LoanAccountancyCapitalCode").
'</td>';
364 print $formaccounting->select_account(
GETPOST(
'accountancy_account_capital') ?
GETPOST(
'accountancy_account_capital') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_CAPITAL'),
'accountancy_account_capital', 1,
'', 1, 1);
368 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanAccountancyInsuranceCode").
'</td>';
370 print $formaccounting->select_account(
GETPOST(
'accountancy_account_insurance') ?
GETPOST(
'accountancy_account_insurance') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_INSURANCE'),
'accountancy_account_insurance', 1,
'', 1, 1);
374 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LoanAccountancyInterestCode").
'</td>';
376 print $formaccounting->select_account(
GETPOST(
'accountancy_account_interest') ?
GETPOST(
'accountancy_account_interest') :
getDolGlobalString(
'LOAN_ACCOUNTING_ACCOUNT_INTEREST'),
'accountancy_account_interest', 1,
'', 1, 1);
381 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"LoanAccountancyCapitalCode").
'</td>';
382 print
'<td><input name="accountancy_account_capital" size="16" value="'.$object->accountancy_account_capital.
'">';
386 print
'<tr><td>'.$langs->trans(
"LoanAccountancyInsuranceCode").
'</td>';
387 print
'<td><input name="accountancy_account_insurance" size="16" value="'.$object->accountancy_account_insurance.
'">';
391 print
'<tr><td>'.$langs->trans(
"LoanAccountancyInterestCode").
'</td>';
392 print
'<td><input name="accountancy_account_interest" size="16" value="'.$object->accountancy_account_interest.
'">';
399 print $form->buttonsSaveCancel(
"Add");
406 $object =
new Loan($db);
407 $result = $object->fetch($id);
412 $totalpaid = $object->getSumPayment();
415 if ($action ==
'paid') {
416 $text = $langs->trans(
'ConfirmPayLoan');
417 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayLoan'), $text,
"confirm_paid",
'',
'', 2);
420 if ($action ==
'delete') {
421 $text = $langs->trans(
'ConfirmDeleteLoan');
422 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteLoan'), $text,
'confirm_delete',
'',
'', 2);
425 if ($action ==
'edit') {
426 print
'<form name="update" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
427 print
'<input type="hidden" name="token" value="'.newToken().
'">';
428 print
'<input type="hidden" name="action" value="update">';
429 print
'<input type="hidden" name="id" value="'.$id.
'">';
432 print
dol_get_fiche_head($head,
'card', $langs->trans(
"Loan"), -1,
'money-bill-alt', 0,
'',
'', 0,
'', 1);
435 $linkback =
'<a href="'.DOL_URL_ROOT.
'/loan/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
437 $morehtmlref =
'<div class="refidno">';
439 $morehtmlref .= $form->editfieldkey(
"Label",
'label', $object->label, $object, $user->hasRight(
'loan',
'write'),
'string',
'', 0, 1);
440 $morehtmlref .= $form->editfieldval(
"Label",
'label', $object->label, $object, $user->hasRight(
'loan',
'write'),
'string',
'',
null,
null,
'', 1);
442 if (isModEnabled(
'project')) {
443 $langs->loadLangs(array(
"projects"));
444 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
445 if ($user->hasRight(
'loan',
'write')) {
446 if ($action !=
'classify') {
447 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
449 if ($action ==
'classify') {
451 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
452 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
453 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
454 $morehtmlref .= $formproject->select_projects(-1, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
455 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
456 $morehtmlref .=
'</form>';
458 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, -1, $object->fk_project,
'none', 0, 0, 0, 1,
'',
'maxwidth300');
461 if (!empty($object->fk_project)) {
463 $proj->fetch($object->fk_project);
464 $morehtmlref .=
' : '.$proj->getNomUrl(1);
466 $morehtmlref .=
' - '.$proj->title;
473 $morehtmlref .=
'</div>';
475 $object->totalpaid = $totalpaid;
477 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
479 print
'<div class="fichecenter">';
480 print
'<div class="fichehalfleft">';
481 print
'<div class="underbanner clearboth"></div>';
483 print
'<table class="border centpercent tableforfield">';
486 if ($action ==
'edit') {
487 print
'<tr><td class="fieldrequired titlefield">'.$langs->trans(
"LoanCapital").
'</td><td>';
488 print
'<input name="capital" size="10" value="'.$object->capital.
'"></td></tr>';
491 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>';
495 if ($action ==
'edit') {
496 print
'<tr><td class="titlefield">'.$langs->trans(
"Insurance").
'</td><td>';
497 print
'<input name="insurance_amount" size="10" value="'.$object->insurance_amount.
'"></td></tr>';
500 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>';
504 print
'<tr><td>'.$langs->trans(
"DateStart").
"</td>";
506 if ($action ==
'edit') {
507 print $form->selectDate($object->datestart,
'start', 0, 0, 0,
'update', 1, 0);
514 print
'<tr><td>'.$langs->trans(
"DateEnd").
"</td>";
516 if ($action ==
'edit') {
517 print $form->selectDate($object->dateend,
'end', 0, 0, 0,
'update', 1, 0);
524 print
'<tr><td>'.$langs->trans(
"Nbterms").
'</td>';
526 if ($action ==
'edit') {
527 print
'<input name="nbterm" size="4" value="'.$object->nbterm.
'">';
529 print $object->nbterm;
534 print
'<tr><td>'.$langs->trans(
"Rate").
'</td>';
536 if ($action ==
'edit') {
537 print
'<input name="rate" size="4" value="'.$object->rate.
'">%';
539 print
price($object->rate).
'%';
545 if ($action ==
'edit') {
546 print
'<td class="nowrap fieldrequired">';
547 print $langs->trans(
"LoanAccountancyCapitalCode");
550 if (isModEnabled(
'accounting')) {
551 print $formaccounting->select_account($object->account_capital,
'accountancy_account_capital', 1,
'', 1, 1);
553 print
'<input name="accountancy_account_capital" size="16" value="'.$object->account_capital.
'">';
557 print
'<td class="nowrap">';
558 print $langs->trans(
"LoanAccountancyCapitalCode");
561 if (isModEnabled(
'accounting')) {
563 $accountingaccount->fetch(
'', $object->account_capital, 1);
565 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
567 print $object->account_capital;
576 if ($action ==
'edit') {
577 print
'<td class="nowrap fieldrequired">';
578 print $langs->trans(
"LoanAccountancyInsuranceCode");
581 if (isModEnabled(
'accounting')) {
582 print $formaccounting->select_account($object->account_insurance,
'accountancy_account_insurance', 1,
'', 1, 1);
584 print
'<input name="accountancy_account_insurance" size="16" value="'.$object->account_insurance.
'">';
588 print
'<td class="nowrap">';
589 print $langs->trans(
"LoanAccountancyInsuranceCode");
592 if (isModEnabled(
'accounting')) {
594 $accountingaccount->fetch(
'', $object->account_insurance, 1);
596 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
598 print $object->account_insurance;
607 if ($action ==
'edit') {
608 print
'<td class="nowrap fieldrequired">';
609 print $langs->trans(
"LoanAccountancyInterestCode");
612 if (isModEnabled(
'accounting')) {
613 print $formaccounting->select_account($object->account_interest,
'accountancy_account_interest', 1,
'', 1, 1);
615 print
'<input name="accountancy_account_interest" size="16" value="'.$object->account_interest.
'">';
619 print
'<td class="nowrap">';
620 print $langs->trans(
"LoanAccountancyInterestCode");
623 if (isModEnabled(
'accounting')) {
625 $accountingaccount->fetch(
'', $object->account_interest, 1);
627 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
629 print $object->account_interest;
637 $parameters = array();
638 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
639 print $hookmanager->resPrint;
644 print
'<div class="fichehalfright">';
649 $sql =
"SELECT p.rowid, p.num_payment, p.datep as dp,";
650 $sql .=
" p.amount_capital, p.amount_insurance, p.amount_interest,";
651 $sql .=
" b.fk_account,";
652 $sql .=
" c.libelle as paiement_type";
653 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_loan as p";
654 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON p.fk_bank = b.rowid";
655 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepayment = c.id,";
656 $sql .=
" ".MAIN_DB_PREFIX.
"loan as l";
657 $sql .=
" WHERE p.fk_loan = ".((int) $id);
658 $sql .=
" AND p.fk_loan = l.rowid";
659 $sql .=
" AND l.entity IN ( ".getEntity(
'loan').
")";
660 $sql .=
" ORDER BY dp DESC";
663 $resql = $db->query($sql);
665 $num = $db->num_rows($resql);
667 $total_insurance = 0;
671 print
'<div class="div-table-responsive-no-min">';
672 print
'<table class="noborder paymenttable">';
673 print
'<tr class="liste_titre">';
674 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
675 print
'<td>'.$langs->trans(
"Date").
'</td>';
676 print
'<td>'.$langs->trans(
"Type").
'</td>';
677 print
'<td>'.$langs->trans(
"BankAccount").
'</td>';
678 print
'<td class="right">'.$langs->trans(
"Insurance").
'</td>';
679 print
'<td class="right">'.$langs->trans(
"Interest").
'</td>';
680 print
'<td class="right">'.$langs->trans(
"LoanCapital").
'</td>';
683 $conf->cache[
'bankaccount'] = array();
686 $objp = $db->fetch_object($resql);
688 print
'<tr class="oddeven">';
689 print
'<td><a href="'.DOL_URL_ROOT.
'/loan/payment/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a></td>';
690 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
691 print
"<td>".$objp->paiement_type.
' '.$objp->num_payment.
"</td>\n";
693 if (!empty($conf->cache[
'bankaccount'][$objp->fk_account])) {
694 $tmpbank = $conf->cache[
'bankaccount'][$objp->fk_account];
697 $tmpbank->fetch($objp->fk_account);
698 $conf->cache[
'bankaccount'][$objp->fk_account] = $tmpbank;
700 print $tmpbank->getNomUrl(1);
702 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency).
"</span></td>\n";
703 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency).
"</span></td>\n";
704 print
'<td class="nowrap right"><span class="amount">'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency).
"</span></td>\n";
706 $total_capital += $objp->amount_capital;
710 $totalpaid = $total_capital;
712 if ($object->paid == 0 || $object->paid == 2) {
713 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>';
714 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>';
716 $staytopay = $object->capital - $totalpaid;
718 print
'<tr><td colspan="6" class="right">'.$langs->trans(
"RemainderToPay").
' :</td>';
719 print
'<td class="nowrap right'.($staytopay ?
' amountremaintopay' :
' amountpaymentcomplete').
'">';
720 print
price($staytopay, 0, $langs, 0, -1, -1, $conf->currency);
734 print
'<div class="clearboth"></div>';
738 if ($action ==
'edit') {
739 print $form->buttonsSaveCancel();
747 if ($action !=
'edit') {
748 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
749 if (empty($reshook)) {
750 print
'<div class="tabsAction">';
753 if (($object->paid == 0 || $object->paid == 2) && $user->hasRight(
'loan',
'write')) {
754 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>';
758 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')) {
759 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>';
763 if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->hasRight(
'loan',
'write')) {
764 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>';
768 if (($object->paid == 0 || $object->paid == 2) && $user->hasRight(
'loan',
'delete')) {
769 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.