diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index 5e8a8d8d50d..811c07c98ed 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -216,6 +216,7 @@ create table llx_salary
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet)
+ label varchar(255),
tms timestamp,
datec datetime, -- Create date
fk_user integer NOT NULL,
@@ -224,16 +225,14 @@ create table llx_salary
salary double(24,8), -- salary of user when payment was done
amount double(24,8) NOT NULL DEFAULT 0,
fk_projet integer DEFAULT NULL,
- fk_typepayment integer NOT NULL,
- num_payment varchar(50), -- num cheque or other
- label varchar(255),
datesp date, -- date start period
dateep date, -- date end period
entity integer DEFAULT 1 NOT NULL, -- multi company id
note text,
fk_bank integer,
paye smallint default 1 NOT NULL,
- fk_account integer,
+ fk_typepayment integer NOT NULL, -- default payment mode for payment
+ fk_account integer, -- default bank account for payment
fk_user_author integer, -- user creating
fk_user_modif integer -- user making last change
)ENGINE=innodb;
@@ -241,7 +240,7 @@ create table llx_salary
ALTER TABLE llx_payment_salary CHANGE COLUMN fk_user fk_user integer NULL;
ALTER TABLE llx_payment_salary ADD COLUMN fk_salary integer;
-INSERT INTO llx_salary (rowid, ref, fk_user, amount, fk_projet, fk_typepayment, num_payment, label, datesp, dateep, entity, note, fk_bank, paye) SELECT ps.rowid, ps.rowid, ps.fk_user, ps.amount, ps.fk_projet, ps.fk_typepayment, ps.num_payment, ps.label, ps.datesp, ps.dateep, ps.entity, ps.note, ps.fk_bank, 1 FROM llx_payment_salary ps WHERE ps.fk_salary IS NULL;
+INSERT INTO llx_salary (rowid, ref, fk_user, amount, fk_projet, fk_typepayment, label, datesp, dateep, entity, note, fk_bank, paye) SELECT ps.rowid, ps.rowid, ps.fk_user, ps.amount, ps.fk_projet, ps.fk_typepayment, ps.label, ps.datesp, ps.dateep, ps.entity, ps.note, ps.fk_bank, 1 FROM llx_payment_salary ps WHERE ps.fk_salary IS NULL;
UPDATE llx_payment_salary as ps SET ps.fk_salary = ps.rowid WHERE ps.fk_salary IS NULL;
UPDATE llx_payment_salary as ps SET ps.ref = ps.rowid WHERE ps.ref IS NULL;
diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php
index 8bd2bd2dac1..58e82a5747c 100755
--- a/htdocs/salaries/card.php
+++ b/htdocs/salaries/card.php
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
@@ -831,7 +832,6 @@ if ($id) {
print '
';
diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php
index e428880485e..7cd831df7ee 100644
--- a/htdocs/salaries/list.php
+++ b/htdocs/salaries/list.php
@@ -209,7 +209,7 @@ $help_url = '';
$title = $langs->trans('Salaries');
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
-$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp as datesp, s.dateep as dateep, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
+$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, ps.fk_typepayment as paymenttype, ";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql .= " pst.code as payment_code,";
$sql .= " SUM(ps.amount) as alreadypayed";
@@ -257,7 +257,10 @@ if ($filtre) {
if ($search_type_id) {
$sql .= " AND s.fk_typepayment=".$search_type_id;
}
-$sql .= " GROUP BY u.rowid, ba.rowid, s.rowid, s.amount, s.dateep, s.datesp, s.label, s.paye, pst.code";
+$sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary, u.fk_soc, u.statut,";
+$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, ps.fk_typepayment, s.fk_bank,";
+$sql .= " ba.rowid, ba.ref, ba.number, ba.account_number, ba.fk_accountancy_journal, ba.label,";
+$sql .= " pst.code";
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
@@ -395,24 +398,20 @@ print '
';
print ' ';
-print $langs->trans('From').' ';
-print $form->selectDate($search_date_start_from ? $search_date_start_from : -1, 'search_date_start_from', 0, 0, 1);
+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'));
print ' ';
print '';
-print $langs->trans('to').' ';
-print $form->selectDate($search_date_start_to ? $search_date_start_to : -1, 'search_date_start_to', 0, 0, 1);
+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'));
print ' ';
print ' | ';
// Date End
print '
';
print ' ';
-print $langs->trans('From').' ';
-print $form->selectDate($search_date_end_from ? $search_date_end_from : -1, 'search_date_end_from', 0, 0, 1);
+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'));
print ' ';
print '';
-print $langs->trans('to').' ';
-print $form->selectDate($search_date_end_to ? $search_date_end_to : -1, 'search_date_end_to', 0, 0, 1);
+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'));
print ' ';
print ' | ';
@@ -420,12 +419,14 @@ print '';
print '
';
$form->select_types_paiements($search_type_id, 'search_type_id', '', 0, 1, 1, 16);
print ' | ';
-// Account
+
+// Bank account
if (!empty($conf->banque->enabled)) {
print '
';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print ' | ';
}
+
// Amount
print '
| ';
@@ -457,9 +458,9 @@ print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $par
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder);
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "s.dateep,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
-print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
+print_liste_field_titre("DefaultPaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder);
if (!empty($conf->banque->enabled)) {
- print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
+ print_liste_field_titre("DefaultBankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "s.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('Status', $_SERVER["PHP_SELF"], "s.paye", '', $param, 'class="right"', $sortfield, $sortorder);
diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php
index df762b1db85..44b6aae4503 100644
--- a/htdocs/salaries/paiement_salary.php
+++ b/htdocs/salaries/paiement_salary.php
@@ -145,7 +145,7 @@ $form = new Form($db);
// Formulaire de creation d'un paiement de charge
if ($action == 'create') {
- $salary = new Salary($db);
+ $salary = new Salary($db); // Salary to pay
$salary->fetch($chid);
$salary->accountid = $salary->fk_account ? $salary->fk_account : $salary->accountid;
$salary->paiementtype = $salary->mode_reglement_id ? $salary->mode_reglement_id : $salary->paiementtype;
diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php
index e5a61fce7a0..8e1b3e8dbea 100644
--- a/htdocs/salaries/payments.php
+++ b/htdocs/salaries/payments.php
@@ -1,11 +1,7 @@
- * Copyright (C) 2004-2014 Laurent Destailleur
- * Copyright (C) 2005-2010 Regis Houssin
- * Copyright (C) 2011-2016 Alexandre Spangaro
- * Copyright (C) 2011-2014 Juanjo Menent
- * Copyright (C) 2015 Jean-François Ferry
- * Copyright (C) 2021 Gauthier VERDOL
+/* Copyright (C) 2011-2019 Alexandre Spangaro
+ * Copyright (C) 2015-2016 Laurent Destailleur
+ * Copyright (C) 2015 Jean-François Ferry
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,206 +18,497 @@
*/
/**
- * \file htdocs/compta/sociales/payments.php
- * \ingroup compta
- * \brief Page to list payments of special expenses
+ * \file htdocs/salaries/list.php
+ * \ingroup salaries
+ * \brief List of salaries payments
*/
require '../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
-require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
-$langs->loadLangs(array('compta', 'bills', 'salaries'));
+$langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
-// Security check
-if ($user->socid) $socid = $user->socid;
-$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
-
-$mode = GETPOST("mode", 'alpha');
-$year = GETPOST("year", 'int');
-$filtre = GETPOST("filtre", 'alpha');
-if (!$year && $mode != 'sconly') { $year = date("Y", time()); }
-$search_user = GETPOST("search_user", 'int');
+$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
+$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
+$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
+$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortfield) $sortfield = "pc.datep";
-if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) $sortfield = "s.datep,s.rowid";
+if (!$sortorder) $sortorder = "DESC,DESC";
+// Initialize technical objects
+$object = new PaymentSalary($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('salarieslist')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+
+if (!$sortfield) $sortfield = "s.datep,s.rowid";
+if (!$sortorder) $sortorder = "DESC,DESC";
+
+$search_ref = GETPOST('search_ref', 'int');
+$search_user = GETPOST('search_user', 'alpha');
+$search_label = GETPOST('search_label', 'alpha');
+$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
+$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
+$search_amount = GETPOST('search_amount', 'alpha');
+$search_account = GETPOST('search_account', 'int');
+
+$filtre = GETPOST("filtre", 'restricthtml');
+
+if (!GETPOST('search_type_id', 'int'))
+{
+ $newfiltre = str_replace('filtre=', '', $filtre);
+ $filterarray = explode('-', $newfiltre);
+ foreach ($filterarray as $val)
+ {
+ $part = explode(':', $val);
+ if ($part[0] == 's.fk_typepayment') $search_type_id = $part[1];
+ }
+} else {
+ $search_type_id = GETPOST('search_type_id', 'int');
+}
+
+$childids = $user->getAllChildIds(1);
+
+// Security check
+$socid = GETPOST("socid", "int");
+if ($user->socid) $socid = $user->socid;
+$result = restrictedArea($user, 'salaries', '', '', '');
+
+// Initialize array of search criterias
+$search_all = GETPOST("search_all", 'alpha');
+$search = array();
+foreach ($object->fields as $key => $val)
+{
+ if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
+}
+
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array();
+foreach ($object->fields as $key => $val)
+{
+ if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
+}
+
+$permissiontoread = $user->rights->salaries->read;
+$permissiontoadd = $user->rights->salaries->write;
+$permissiontodelete = $user->rights->salaries->delete;
+
+
+/*
+ * Actions
+ */
+
+if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
+
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+if (empty($reshook))
+{
+ // Selection of new fields
+ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+
+ // Purge search criteria
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
+ {
+ $search_ref = "";
+ $search_user = "";
+ $search_label = "";
+ $search_date_start = '';
+ $search_date_end = '';
+ $search_amount = "";
+ $search_account = '';
+ $search_type_id = "";
+ }
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
+ || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
+ {
+ $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
+ }
+
+ // Mass actions
+ $objectclass = 'PaymentSalary';
+ $objectlabel = 'SalariesPayments';
+ $uploaddir = $conf->salaries->dir_output;
+ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
+
+ // Validate records
+ if (!$error && $massaction == 'buildsepa' && $permissiontoadd)
+ {
+ $objecttmp = new $objectclass($db);
+
+ // TODO
+ }
+}
/*
* View
*/
-$payment_salary_static = new PaymentSalary($db);
-$sal_static = new Salary($db);
+$form = new Form($db);
+$salstatic = new PaymentSalary($db);
+$userstatic = new User($db);
+$accountstatic = new Account($db);
-llxHeader('', $langs->trans("SalariesArea"));
+$now = dol_now();
-$title = $langs->trans("SalariesPayments");
-if (!empty($search_user)) {
- $u = new user($db);
- $u->fetch($search_user);
- $title = $langs->trans("SalariesPaymentsOf", '{s1}');
- $title = $title = str_replace('{s1}', $u->getNomUrl(), $title);
+//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
+$help_url = '';
+$title = $langs->trans('SalariesPayments');
+
+$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,";
+$sql .= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
+$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
+$sql .= " pst.code as payment_code";
+$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
+$sql .= " ".MAIN_DB_PREFIX."user as u";
+$sql .= " WHERE u.rowid = s.fk_user";
+$sql .= " AND s.entity IN (".getEntity('payment_salaries').")";
+if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
+
+// Search criteria
+if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref);
+if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user);
+if ($search_label) $sql .= natural_search(array('s.label'), $search_label);
+if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'";
+if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'";
+if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1);
+if ($search_account > 0) $sql .= " AND b.fk_account=".((int) $search_account);
+if ($filtre) {
+ $filtre = str_replace(":", "=", $filtre);
+ $sql .= " AND ".$filtre;
+}
+if ($search_type_id) {
+ $sql .= " AND s.fk_typepayment=".$search_type_id;
+}
+$sql .= $db->order($sortfield, $sortorder);
+
+// Count total nb of records
+$nbtotalofrecords = '';
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+{
+ $resql = $db->query($sql);
+ $nbtotalofrecords = $db->num_rows($resql);
+ if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
+ {
+ $page = 0;
+ $offset = 0;
+ }
+}
+// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
+if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
+{
+ $num = $nbtotalofrecords;
+} else {
+ if ($limit) $sql .= $db->plimit($limit + 1, $offset);
+
+ $resql = $db->query($sql);
+ if (!$resql)
+ {
+ dol_print_error($db);
+ exit;
+ }
+
+ $num = $db->num_rows($resql);
}
+// Output page
+// --------------------------------------------------------------------
+
+llxHeader('', $title, $help_url);
+
+$arrayofselected = is_array($toselect) ? $toselect : array();
+
$param = '';
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
-if ($mode == 'sconly') $param = '&mode=sconly';
-if ($sortfield) $param .= '&sortfield='.$sortfield;
-if ($sortorder) $param .= '&sortorder='.$sortorder;
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+if ($search_type_id) $param .= '&search_type_id='.urlencode($search_type_id);
+if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
+if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
+if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
+if ($search_label) $param .= '&search_label='.urlencode($search_label);
+if ($search_account) $param .= '&search_account='.urlencode($search_account);
+if ($search_date_start) $param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int'));
+if ($search_date_end) $param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int'));
+// Add $param from extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+// List of mass actions available
+$arrayofmassactions = array(
+ //'presend'=>$langs->trans("SendByMail"),
+ //'buildsepa'=>$langs->trans("BuildSepa"), // TODO
+);
+//if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete");
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
+$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
-print ''."\n";
// End of page
llxFooter();