31require
'../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
34if (isModEnabled(
'accounting')) {
35 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
47$langs->loadLangs(array(
"compta",
"salaries",
"bills",
"hrm"));
49$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
50$massaction =
GETPOST(
'massaction',
'alpha');
52$confirm =
GETPOST(
'confirm',
'alpha');
53$cancel =
GETPOST(
'cancel',
'alpha');
54$toselect =
GETPOST(
'toselect',
'array');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
56$backtopage =
GETPOST(
'backtopage',
'alpha');
57$optioncss =
GETPOST(
'optioncss',
'aZ');
63$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
64$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
66if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
70$offset = $limit * $page;
74 $sortfield =
"s.datep,s.rowid";
77 $sortorder =
"DESC,DESC";
83$diroutputmassaction =
$conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
84$hookmanager->initHooks(array(
'salarieslist'));
87$extrafields->fetch_name_optionals_label(
$object->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
92 $sortfield =
"s.datep,s.rowid";
95 $sortorder =
"DESC,DESC";
98$search_ref =
GETPOST(
'search_ref',
'alpha');
99$search_user =
GETPOST(
'search_user',
'alpha');
100$search_label =
GETPOST(
'search_label',
'alpha');
105$search_amount =
GETPOST(
'search_amount',
'alpha');
106$search_account =
GETPOST(
'search_account',
'alpha');
107$search_status =
GETPOST(
'search_status',
'intcomma');
108$search_type_id =
GETPOST(
'search_type_id',
'intcomma');
110$childids = $user->getAllChildIds(1);
113$search_all =
GETPOST(
"search_all",
'alpha');
115foreach (
$object->fields as $key => $val) {
116 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
117 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
119 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
126$fieldstosearchall = array();
127foreach (
$object->fields as $key => $val) {
128 if (!empty($val[
'searchall'])) {
129 $fieldstosearchall[
's.'.$key] = $val[
'label'];
134$arrayfields = array();
135foreach (
$object->fields as $key => $val) {
137 if (!empty($val[
'visible'])) {
138 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
139 $arrayfields[
's.'.$key] = array(
140 'label' => $val[
'label'],
141 'checked' => (($visible < 0) ? 0 : 1),
142 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
143 'position' => $val[
'position'],
144 'help' => isset($val[
'help']) ? $val[
'help'] :
''
149include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
154$permissiontoread = $user->hasRight(
'salaries',
'read');
155$permissiontoadd = $user->hasRight(
'salaries',
'write');
156$permissiontodelete = $user->hasRight(
'salaries',
'delete');
163 $socid = $user->socid;
172if (
GETPOST(
'cancel',
'alpha')) {
176if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
181if ($massaction ==
'withdrawrequest') {
182 $langs->load(
"withdrawals");
184 if (!$user->hasRight(
'paymentbybanktransfer',
'create')) {
190 $listofSalries = array();
191 $arrayofselected = is_array($toselect) ? $toselect : array();
192 foreach ($arrayofselected as $toselectid) {
193 $objecttmp =
new Salary($db);
194 $result = $objecttmp->fetch($toselectid);
196 $totalpaid = $objecttmp->getSommePaiement();
197 $objecttmp->resteapayer =
price2num((
float) $objecttmp->amount - $totalpaid,
'MT');
200 $parameters = array(
'remaintopay' => $objecttmp->resteapayer);
201 $reshook = $hookmanager->executeHooks(
'finalizeAmountOfInvoice', $parameters, $objecttmp, $action);
203 if (!empty($remaintopay = $hookmanager->resArray[
'remaintopay'])) {
204 $objecttmp->resteapayer = $remaintopay;
206 } elseif ($reshook < 0) {
208 setEventMessages($objecttmp->ref.
' '.$langs->trans(
"ProcessingError"), $hookmanager->errors,
'errors');
211 if ($objecttmp->status == Salary::STATUS_PAID || $objecttmp->resteapayer == 0) {
213 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"AlreadyPaid"), $objecttmp->errors,
'errors');
214 } elseif ($resteapayer < 0) {
216 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"AmountMustBePositive"), $objecttmp->errors,
'errors');
219 $rsql =
"SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
220 $rsql .=
" , pfd.date_traite as date_traite";
221 $rsql .=
" , pfd.amount";
222 $rsql .=
" , u.rowid as user_id, u.lastname, u.firstname, u.login";
223 $rsql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
224 $rsql .=
" , ".MAIN_DB_PREFIX.
"user as u";
225 $rsql .=
" WHERE fk_salary = ".((int) $objecttmp->id);
226 $rsql .=
" AND pfd.fk_user_demande = u.rowid";
227 $rsql .=
" AND pfd.traite = 0";
228 $rsql .=
" ORDER BY pfd.date_demande DESC";
230 $result_sql = $db->query($rsql);
232 $numprlv = $db->num_rows($result_sql);
237 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"RequestAlreadyDone"), $objecttmp->errors,
'warnings');
238 } elseif (!empty($objecttmp->type_payment_code) && $objecttmp->type_payment_code !=
'VIR') {
239 $langs->load(
"errors");
241 setEventMessages($langs->trans(
"Salary").
' '.$objecttmp->ref.
' : '.$langs->trans(
"ErrorThisPaymentModeIsNotCreditTransfer"), $objecttmp->errors,
'errors');
243 $listofSalries[] = $objecttmp;
249 if (!$error && !empty($listofSalries)) {
250 $nbwithdrawrequestok = 0;
251 foreach ($listofSalries as $salary) {
253 $result = $salary->demande_prelevement($user, (
float) $salary->resteapayer,
'salaire');
256 $nbwithdrawrequestok++;
262 if ($nbwithdrawrequestok > 0) {
263 setEventMessages($langs->trans(
"WithdrawRequestsDone", $nbwithdrawrequestok),
null,
'mesgs');
269$parameters = array();
270$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
275if (empty($reshook)) {
277 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
280 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
284 $search_date_start_from =
'';
285 $search_date_start_to =
'';
286 $search_date_end_from =
'';
287 $search_date_end_to =
'';
288 $search_date_end =
'';
290 $search_account =
'';
292 $search_type_id =
"";
294 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
295 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
300 $objectclass =
'Salary';
301 $objectlabel =
'Salaries';
302 $uploaddir =
$conf->salaries->dir_output;
303 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
306 if (!$error && $massaction ==
'buildsepa' && $permissiontoadd) {
307 $objecttmp =
new $objectclass($db);
317$form =
new Form($db);
318$salstatic =
new Salary($db);
319$userstatic =
new User($db);
320$accountstatic =
new Account($db);
324$title = $langs->trans(
'Salaries');
332$sql =
"SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
333$sql .=
" s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment as paymenttype, ";
334$sql .=
" ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
335$sql .=
" pst.code as payment_code,";
336$sql .=
" SUM(ps.amount) as alreadypayed";
338if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
339 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
340 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
344$parameters = array();
345$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
346$sql .= $hookmanager->resPrint;
347$sql = preg_replace(
'/,\s*$/',
'', $sql);
352$sql .=
" FROM ".MAIN_DB_PREFIX.
"salary as s";
353if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
354 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (s.rowid = ef.fk_object)";
356$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"payment_salary as ps ON (ps.fk_salary = s.rowid) ";
357$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pst ON (s.fk_typepayment = pst.id) ";
358$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account ba ON (ba.rowid = s.fk_account), ";
360$sql .=
" ".MAIN_DB_PREFIX.
"user as u";
361$sql .=
" WHERE u.rowid = s.fk_user";
362$sql .=
" AND s.entity IN (".getEntity(
'salaries').
")";
363if (!$user->hasRight(
'salaries',
'readall')) {
364 $sql .=
" AND s.fk_user IN (".$db->sanitize(implode(
',', $childids)).
")";
370 $sql .=
" AND s.rowid=".((int) $search_ref);
373 $sql .=
natural_search(array(
'u.login',
'u.lastname',
'u.firstname',
'u.email'), $search_user);
378if (!empty($search_date_start_from)) {
379 $sql .=
" AND s.datesp >= '".$db->idate($search_date_start_from).
"'";
381if (!empty($search_date_end_from)) {
382 $sql .=
" AND s.dateep >= '".$db->idate($search_date_end_from).
"'";
384if (!empty($search_date_start_to)) {
385 $sql .=
" AND s.datesp <= '".$db->idate($search_date_start_to).
"'";
387if (!empty($search_date_end_to)) {
388 $sql .=
" AND s.dateep <= '".$db->idate($search_date_end_to).
"'";
394if ($search_account > 0) {
395 $sql .=
" AND s.fk_account=".((int) $search_account);
397if ($search_status !=
'' && $search_status >= 0) {
398 $sql .=
" AND s.paye = ".((int) $search_status);
400if ($search_type_id) {
401 $sql .=
" AND s.fk_typepayment=".((int) $search_type_id);
404include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
405$sql .=
" GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.photo, u.salary, u.fk_soc, u.statut,";
406$sql .=
" s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,";
407$sql .=
" ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos,";
411$nbtotalofrecords =
'';
414 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
415 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
416 $resql = $db->query($sqlforcount);
418 $objforcount = $db->fetch_object($resql);
419 $nbtotalofrecords = $objforcount->nbtotalofrecords;
424 if (($page * $limit) > $nbtotalofrecords) {
432$sql .= $db->order($sortfield, $sortorder);
434 $sql .= $db->plimit($limit + 1, $offset);
437$resql = $db->query($sql);
443$num = $db->num_rows($resql);
447if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
448 $obj = $db->fetch_object($resql);
450 header(
"Location: ".DOL_URL_ROOT.
'/salaries/card.php?id='.
$id);
458llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
460$arrayofselected = is_array($toselect) ? $toselect : array();
464 $param .=
'&mode='.urlencode($mode);
466if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
467 $param .=
'&contextpage='.urlencode($contextpage);
469if ($limit > 0 && $limit !=
$conf->liste_limit) {
470 $param .=
'&limit='.((int) $limit);
472if ($search_type_id) {
473 $param .=
'&search_type_id='.urlencode($search_type_id);
475if ($optioncss !=
'') {
476 $param .=
'&optioncss='.urlencode($optioncss);
478if ($search_ref !=
'') {
479 $param .=
'&search_ref='.urlencode($search_ref);
481if ($search_user !=
'') {
482 $param .=
'&search_user='.urlencode($search_user);
485 $param .=
'&search_label='.urlencode($search_label);
487if ($search_account) {
488 $param .=
'&search_account='.urlencode((
string) ($search_account));
490if ($search_status !=
'' && $search_status !=
'-1') {
491 $param .=
'&search_status='.urlencode($search_status);
493if (!empty($search_date_start_from)) {
494 $param .=
'&search_date_start_fromday='.urlencode(
GETPOST(
'search_date_start_fromday')).
'&search_date_start_frommonth='.urlencode(
GETPOST(
'search_date_start_frommonth')).
'&search_date_start_fromyear='.urlencode(
GETPOST(
'search_date_start_fromyear'));
496if (!empty($search_date_start_to)) {
497 $param .=
"&search_date_start_today=".urlencode(
GETPOST(
'search_date_start_today')).
"&search_date_start_tomonth=".urlencode(
GETPOST(
'search_date_start_tomonth')).
"&search_date_start_toyear=".urlencode(
GETPOST(
'search_date_start_toyear'));
499if (!empty($search_date_end_from)) {
500 $param .=
'&search_date_end_fromday='.urlencode(
GETPOST(
'search_date_end_fromday')).
'&search_date_end_frommonth='.urlencode(
GETPOST(
'search_date_end_frommonth')).
'&search_date_end_fromyear='.urlencode(
GETPOST(
'search_date_end_fromyear'));
502if (!empty($search_date_end_to)) {
503 $param .=
"&search_date_end_today=".urlencode(
GETPOST(
'search_date_end_today')).
"&search_date_end_tomonth=".urlencode(
GETPOST(
'search_date_end_tomonth')).
"&search_date_end_toyear=".urlencode(
GETPOST(
'search_date_end_toyear'));
507include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
509$parameters = array(
'param' => &$param);
510$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
511$param .= $hookmanager->resPrint;
514$arrayofmassactions = array(
518if (!empty($permissiontodelete)) {
519 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
521if (isModEnabled(
'paymentbybanktransfer') && $user->hasRight(
'paymentbybanktransfer',
'create')) {
522 $langs->load(
"withdrawals");
523 $arrayofmassactions[
'withdrawrequest'] =
img_picto(
'',
'payment',
'class="pictofixedwidth"').$langs->trans(
"MakeBankTransferOrder");
525if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
526 $arrayofmassactions = array();
528$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
530print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
531if ($optioncss !=
'') {
532 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
534print
'<input type="hidden" name="token" value="'.newToken().
'">';
535print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
536print
'<input type="hidden" name="action" value="list">';
537print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
538print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
539print
'<input type="hidden" name="page" value="'.$page.
'">';
540print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
541print
'<input type="hidden" name="page_y" value="">';
542print
'<input type="hidden" name="mode" value="'.$mode.
'">';
545$url = DOL_URL_ROOT.
'/salaries/card.php?action=create';
547 $url .=
'&socid='.$socid;
551$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
552$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
554$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSalary'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
556print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
559$topicmail =
"SendSalaryRef";
560$modelmail =
"salary";
561$objecttmp =
new Salary($db);
562$trackid =
'sal'.$object->id;
563include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
567$parameters = array();
568$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
569if (empty($reshook)) {
570 $moreforfilter .= $hookmanager->resPrint;
572 $moreforfilter = $hookmanager->resPrint;
575if (!empty($moreforfilter)) {
576 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
577 print $moreforfilter;
581$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
582$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
583$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
584$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
586print
'<div class="div-table-responsive">';
587print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
591print
'<tr class="liste_titre_filter">';
594 print
'<td class="liste_titre center maxwidthsearch">';
595 $searchpicto = $form->showFilterButtons(
'left');
600if (!empty($arrayfields[
's.ref'][
'checked'])) {
601 print
'<td class="liste_titre left">';
602 print
'<input class="flat width50" type="text" name="search_ref" value="'.$db->escape($search_ref).
'">';
607if (!empty($arrayfields[
's.label'][
'checked'])) {
608 print
'<td class="liste_titre"><input type="text" class="flat width100" name="search_label" value="'.$db->escape($search_label).
'"></td>';
612if (!empty($arrayfields[
's.datesp'][
'checked'])) {
613 print
'<td class="liste_titre center">';
614 print
'<div class="nowrapfordate">';
615 print $form->selectDate($search_date_start_from ? $search_date_start_from : -1,
'search_date_start_from', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
617 print
'<div class="nowrapfordate">';
618 print $form->selectDate($search_date_start_to ? $search_date_start_to : -1,
'search_date_start_to', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
624if (!empty($arrayfields[
's.dateep'][
'checked'])) {
625 print
'<td class="liste_titre center">';
626 print
'<div class="nowrapfordate">';
627 print $form->selectDate($search_date_end_from ? $search_date_end_from : -1,
'search_date_end_from', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
629 print
'<div class="nowrapfordate">';
630 print $form->selectDate($search_date_end_to ? $search_date_end_to : -1,
'search_date_end_to', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
636if (!empty($arrayfields[
's.fk_user'][
'checked'])) {
637 print
'<td class="liste_titre">';
638 print
'<input class="flat" type="text" size="6" name="search_user" value="'.$db->escape($search_user).
'">';
643if (!empty($arrayfields[
's.fk_typepayment'][
'checked'])) {
644 print
'<td class="liste_titre left">';
645 print $form->select_types_paiements($search_type_id,
'search_type_id',
'', 0, 1, 1, 16, 1,
'maxwidth125', 1);
650if (isModEnabled(
"bank")) {
651 if (!empty($arrayfields[
's.fk_account'][
'checked'])) {
652 print
'<td class="liste_titre">';
653 print $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth125', 1);
659include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
662if (!empty($arrayfields[
's.amount'][
'checked'])) {
663 print
'<td class="liste_titre right"><input name="search_amount" class="flat" type="text" size="8" value="'.$db->escape($search_amount).
'"></td>';
667if (!empty($arrayfields[
's.paye'][
'checked'])) {
668 print
'<td class="liste_titre center parentonrightofpage">';
669 $liststatus = array(
'0' => $langs->trans(
"Unpaid"),
'1' => $langs->trans(
"Paid"));
671 print $form->selectarray(
'search_status', $liststatus, $search_status, 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
676$parameters = array(
'arrayfields' => $arrayfields);
677$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
678print $hookmanager->resPrint;
681 print
'<td class="liste_titre center maxwidthsearch">';
682 $searchpicto = $form->showFilterButtons();
688$totalarray = array();
689$totalarray[
'nbfield'] = 0;
693print
'<tr class="liste_titre">';
696 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
697 $totalarray[
'nbfield']++;
700if (!empty($arrayfields[
's.ref'][
'checked'])) {
702 $totalarray[
'nbfield']++;
705if (!empty($arrayfields[
's.label'][
'checked'])) {
707 $totalarray[
'nbfield']++;
710if (!empty($arrayfields[
's.datesp'][
'checked'])) {
711 print_liste_field_titre(
"DateStart", $_SERVER[
"PHP_SELF"],
"s.datesp,s.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
712 $totalarray[
'nbfield']++;
715if (!empty($arrayfields[
's.dateep'][
'checked'])) {
716 print_liste_field_titre(
"DateEnd", $_SERVER[
"PHP_SELF"],
"s.dateep,s.rowid",
"", $param,
'', $sortfield, $sortorder,
'center ');
717 $totalarray[
'nbfield']++;
720if (!empty($arrayfields[
's.fk_user'][
'checked'])) {
721 print_liste_field_titre(
"Employee", $_SERVER[
"PHP_SELF"],
"u.lastname",
"", $param,
"", $sortfield, $sortorder);
722 $totalarray[
'nbfield']++;
725if (!empty($arrayfields[
's.fk_typepayment'][
'checked'])) {
726 print_liste_field_titre(
"DefaultPaymentMode", $_SERVER[
"PHP_SELF"],
"type",
"", $param,
'', $sortfield, $sortorder);
727 $totalarray[
'nbfield']++;
730if (isModEnabled(
"bank")) {
731 if (!empty($arrayfields[
's.fk_account'][
'checked'])) {
732 print_liste_field_titre(
"DefaultBankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
733 $totalarray[
'nbfield']++;
738include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
740if (!empty($arrayfields[
's.amount'][
'checked'])) {
741 print_liste_field_titre(
"Amount", $_SERVER[
"PHP_SELF"],
"s.amount",
"", $param,
'', $sortfield, $sortorder,
'right ');
742 $totalarray[
'nbfield']++;
745if (!empty($arrayfields[
's.paye'][
'checked'])) {
746 print_liste_field_titre(
'Status', $_SERVER[
"PHP_SELF"],
"s.paye",
'', $param,
'', $sortfield, $sortorder,
'center ');
747 $totalarray[
'nbfield']++;
751$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
752$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
753print $hookmanager->resPrint;
756 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
757 $totalarray[
'nbfield']++;
763$needToFetchEachLine = 0;
764if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
765 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
766 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
767 $needToFetchEachLine++;
775$savnbfield = $totalarray[
'nbfield'];
776$totalarray = array();
777$totalarray[
'nbfield'] = 0;
778$totalarray[
'val'] = array();
779$totalarray[
'val'][
'totalttcfield'] = 0;
780$imaxinloop = ($limit ? min($num, $limit) : $num);
781while ($i < $imaxinloop) {
782 $obj = $db->fetch_object($resql);
788 $object->setVarsFromFetchObj($obj);
790 $userstatic->id = $obj->uid;
791 $userstatic->lastname = $obj->lastname;
792 $userstatic->firstname = $obj->firstname;
793 $userstatic->admin = $obj->admin;
794 $userstatic->login = $obj->login;
795 $userstatic->email = $obj->email;
796 $userstatic->socid = $obj->fk_soc;
797 $userstatic->statut = $obj->status;
798 $userstatic->status = $obj->status;
799 $userstatic->photo = $obj->photo;
801 $salstatic->id = $obj->rowid;
802 $salstatic->ref = $obj->rowid;
803 $salstatic->label = $obj->label;
804 $salstatic->paye = $obj->paye;
805 $salstatic->status = $obj->paye;
806 $salstatic->alreadypaid = $obj->alreadypayed;
807 $salstatic->totalpaid = $obj->alreadypayed;
808 $salstatic->datesp = $obj->datesp;
809 $salstatic->dateep = $obj->dateep;
810 $salstatic->amount = $obj->amount;
811 $salstatic->type_payment = $obj->payment_code;
813 if ($mode ==
'kanban') {
815 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
816 print
'<div class="box-flex-container kanban">';
819 if ($massactionbutton || $massaction) {
821 if (in_array(
$object->id, $arrayofselected)) {
825 print $salstatic->getKanbanView(
'', array(
'user' => $userstatic,
'selected' => $selected));
826 if ($i == ($imaxinloop - 1)) {
833 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
836 print
'<td class="nowrap center">';
837 if ($massactionbutton || $massaction) {
839 if (in_array(
$object->id, $arrayofselected)) {
842 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
846 $totalarray[
'nbfield']++;
851 if (!empty($arrayfields[
's.ref'][
'checked'])) {
852 print
"<td>".$salstatic->getNomUrl(1).
"</td>\n";
854 $totalarray[
'nbfield']++;
859 if (!empty($arrayfields[
's.label'][
'checked'])) {
860 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
"</td>\n";
862 $totalarray[
'nbfield']++;
867 if (!empty($arrayfields[
's.datesp'][
'checked'])) {
868 print
'<td class="center">'.dol_print_date($db->jdate($obj->datesp),
'day').
"</td>\n";
870 $totalarray[
'nbfield']++;
875 if (!empty($arrayfields[
's.dateep'][
'checked'])) {
876 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateep),
'day').
"</td>\n";
878 $totalarray[
'nbfield']++;
883 if (!empty($arrayfields[
's.fk_user'][
'checked'])) {
884 print
'<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1).
"</td>\n";
886 $totalarray[
'nbfield']++;
891 if (!empty($arrayfields[
's.fk_typepayment'][
'checked'])) {
892 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"PaymentTypeShort".$obj->payment_code)).
'">';
893 if (!empty($obj->payment_code)) {
894 print $langs->trans(
"PaymentTypeShort".$obj->payment_code);
898 $totalarray[
'nbfield']++;
903 if (isModEnabled(
"bank")) {
904 if (!empty($arrayfields[
's.fk_account'][
'checked'])) {
906 if ($obj->fk_account > 0) {
908 $accountstatic->id = $obj->bid;
909 $accountstatic->ref = $obj->bref;
910 $accountstatic->label = $obj->blabel;
911 $accountstatic->number = $obj->bnumber;
912 $accountstatic->iban = $obj->iban;
913 $accountstatic->bic = $obj->bic;
914 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
915 $accountstatic->account_number = $obj->account_number;
916 $accountstatic->clos = $obj->clos;
917 $accountstatic->status = $obj->clos;
919 if (isModEnabled(
'accounting')) {
920 $accountstatic->account_number = $obj->account_number;
923 $accountingjournal->fetch($obj->fk_accountancy_journal);
925 $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
928 print $accountstatic->getNomUrl(1);
934 $totalarray[
'nbfield']++;
940 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
943 if (!empty($arrayfields[
's.amount'][
'checked'])) {
944 print
'<td class="nowraponall right"><span class="amount">'.price($obj->amount).
'</span></td>';
946 $totalarray[
'nbfield']++;
949 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'totalttcfield';
951 $totalarray[
'val'][
'totalttcfield'] += $obj->amount;
955 if (!empty($arrayfields[
's.paye'][
'checked'])) {
956 print
'<td class="nowraponall center">'.$salstatic->getLibStatut(5, $obj->alreadypayed).
'</td>';
958 $totalarray[
'nbfield']++;
963 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
964 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
965 print $hookmanager->resPrint;
969 print
'<td class="nowrap center">';
970 if ($massactionbutton || $massaction) {
972 if (in_array(
$object->id, $arrayofselected)) {
975 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
979 $totalarray[
'nbfield']++;
989include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1001 if (isModEnabled(
"bank")) {
1004 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1010$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1011$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1012print $hookmanager->resPrint;
1014print
'</table>'.
"\n";
1017print
'</form>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage accounting journals.
Class to manage salary payments.
Class to manage Dolibarr users.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.