Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/accountancy/bookkeeping/card.php
	htdocs/compta/facture/list.php
This commit is contained in:
Laurent Destailleur 2018-04-08 13:10:10 +02:00
commit 99ed9c4589
9 changed files with 236 additions and 181 deletions

View File

@ -27,9 +27,8 @@
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
require '../../main.inc.php';
// Class require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
@ -65,39 +64,23 @@ $accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' :
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
$accounting_modes = array ( if (! $error)
'RECETTES-DEPENSES', {
'CREANCES-DETTES' foreach ($list as $constname)
); {
$constvalue = GETPOST($constname, 'alpha');
$accounting_mode = GETPOST('accounting_mode', 'alpha'); if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
if (in_array($accounting_mode, $accounting_modes)) { }
}
if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { if ($error) {
$error ++; setEventMessages($langs->trans("Error"), null, 'errors');
} }
} else {
$error ++;
} }
if ($error) {
setEventMessages($langs->trans("Error"), null, 'errors');
}
foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -36,26 +36,28 @@ $langs->load("accountancy");
$langs->load("bills"); $langs->load("bills");
$langs->load("compta"); $langs->load("compta");
$action = GETPOST('action','aZ09');
$id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
$piece_num = GETPOST("piece_num",'int'); // id of transaction (several lines share the same transaction id)
// Security check // Security check
$id = GETPOST('id', 'int');
if ($user->societe_id > 0) { if ($user->societe_id > 0) {
accessforbidden(); accessforbidden();
} }
$action = GETPOST('action','aZ09');
$mode = GETPOST('mode','aZ09'); // '' or 'tmp'
$piece_num = GETPOST("piece_num");
$mesg = ''; $mesg = '';
$account_number = GETPOST('account_number'); $account_number = GETPOST('account_number','alphanohtml');
$subledger_account = GETPOST('subledger_account'); $subledger_account = GETPOST('subledger_account','alphanohtml');
if ($subledger_account == - 1) { if ($subledger_account == - 1) {
$subledger_account = null; $subledger_account = null;
} }
$label_compte = GETPOST('label_compte'); $label_compte = GETPOST('label_compte','alphanohtml');
$label_operation= GETPOST('label_operation'); $label_operation= GETPOST('label_operation','alphanohtml');
$debit = price2num(GETPOST('debit')); $debit = price2num(GETPOST('debit','alpha'));
$credit = price2num(GETPOST('credit')); $credit = price2num(GETPOST('credit','alpha'));
$save = GETPOST('save','alpha'); $save = GETPOST('save','alpha');
if (! empty($save)) $action = 'add'; if (! empty($save)) $action = 'add';
@ -340,13 +342,14 @@ if ($action == 'create')
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr>';
/*print '<tr>';
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>'; print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>';
print '<td>' . $next_num_mvt . '</td>'; print '<td>' . $next_num_mvt . '</td>';
print '</tr>'; print '</tr>';*/
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Docdate") . '</td>'; print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Docdate") . '</td>';
print '<td>'; print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>'; print '</td>';
@ -389,7 +392,7 @@ if ($action == 'create')
if (! empty($book->piece_num)) if (! empty($book->piece_num))
{ {
$backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans('BackToList') . '</a>'; $backlink = '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">' . $langs->trans('BackToList') . '</a>';
print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); print load_fiche_titre($langs->trans("UpdateMvts"), $backlink);
@ -594,7 +597,7 @@ if ($action == 'create')
print "</tr>\n"; print "</tr>\n";
foreach ( $book->linesmvt as $line ) { foreach ($book->linesmvt as $line) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$total_debit += $line->debit; $total_debit += $line->debit;
$total_credit += $line->credit; $total_credit += $line->credit;

View File

@ -39,8 +39,8 @@ $action = GETPOST('action', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_doc_type = GETPOST("search_doc_type"); $search_doc_type = GETPOST("search_doc_type");
$search_doc_ref = GETPOST("search_doc_ref"); $search_doc_ref = GETPOST("search_doc_ref");
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $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(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int')); $search_date_creation_start = dol_mktime(0, 0, 0, GETPOST('date_creation_startmonth', 'int'), GETPOST('date_creation_startday', 'int'), GETPOST('date_creation_startyear', 'int'));
$search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int')); $search_date_creation_end = dol_mktime(0, 0, 0, GETPOST('date_creation_endmonth', 'int'), GETPOST('date_creation_endday', 'int'), GETPOST('date_creation_endyear', 'int'));
@ -75,6 +75,8 @@ if ($search_accountancy_aux_code_end == - 1) {
} }
$search_mvt_label = GETPOST('search_mvt_label', 'alpha'); $search_mvt_label = GETPOST('search_mvt_label', 'alpha');
$search_direction = GETPOST('search_direction', 'alpha'); $search_direction = GETPOST('search_direction', 'alpha');
$search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'alpha');
// Load variable for pagination // Load variable for pagination
@ -98,7 +100,7 @@ $form = new Form($db);
if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int')) if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int'))
{ {
if (empty($search_date_start) && empty($search_date_end)) if (empty($search_date_start) && empty($search_date_end) && ! GETPOSTISSET('restore_lastsearch_values'))
{ {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; $query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
@ -181,12 +183,12 @@ $filter = array ();
if (! empty($search_date_start)) { if (! empty($search_date_start)) {
$filter['t.doc_date>='] = $search_date_start; $filter['t.doc_date>='] = $search_date_start;
$tmp=dol_getdate($search_date_start); $tmp=dol_getdate($search_date_start);
$param .= '&date_startmonth=' . $tmp['mon'] . '&date_startday=' . $tmp['mday'] . '&date_startyear=' . $tmp['year']; $param .= '&search_date_startmonth=' . $tmp['mon'] . '&search_date_startday=' . $tmp['mday'] . '&search_date_startyear=' . $tmp['year'];
} }
if (! empty($search_date_end)) { if (! empty($search_date_end)) {
$filter['t.doc_date<='] = $search_date_end; $filter['t.doc_date<='] = $search_date_end;
$tmp=dol_getdate($search_date_end); $tmp=dol_getdate($search_date_end);
$param .= '&date_endmonth=' . $tmp['mon'] . '&date_endday=' . $tmp['mday'] . '&date_endyear=' . $tmp['year']; $param .= '&search_date_endmonth=' . $tmp['mon'] . '&search_date_endday=' . $tmp['mday'] . '&search_date_endyear=' . $tmp['year'];
} }
if (! empty($search_doc_date)) { if (! empty($search_doc_date)) {
$filter['t.doc_date'] = $search_doc_date; $filter['t.doc_date'] = $search_doc_date;
@ -195,51 +197,51 @@ if (! empty($search_doc_date)) {
} }
if (! empty($search_doc_type)) { if (! empty($search_doc_type)) {
$filter['t.doc_type'] = $search_doc_type; $filter['t.doc_type'] = $search_doc_type;
$param .= '&search_doc_type=' . $search_doc_type; $param .= '&search_doc_type=' . urlencode($search_doc_type);
} }
if (! empty($search_doc_ref)) { if (! empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref; $filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref=' . $search_doc_ref; $param .= '&search_doc_ref=' . urlencode($search_doc_ref);
} }
if (! empty($search_accountancy_code)) { if (! empty($search_accountancy_code)) {
$filter['t.numero_compte'] = $search_accountancy_code; $filter['t.numero_compte'] = $search_accountancy_code;
$param .= '&search_accountancy_code=' . $search_accountancy_code; $param .= '&search_accountancy_code=' . urlencode($search_accountancy_code);
} }
if (! empty($search_accountancy_code_start)) { if (! empty($search_accountancy_code_start)) {
$filter['t.numero_compte>='] = $search_accountancy_code_start; $filter['t.numero_compte>='] = $search_accountancy_code_start;
$param .= '&search_accountancy_code_start=' . $search_accountancy_code_start; $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
} }
if (! empty($search_accountancy_code_end)) { if (! empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end=' . $search_accountancy_code_end; $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
} }
if (! empty($search_accountancy_aux_code)) { if (! empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code; $filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code=' . $search_accountancy_aux_code; $param .= '&search_accountancy_aux_code=' . urlencode($search_accountancy_aux_code);
} }
if (! empty($search_accountancy_aux_code_start)) { if (! empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start; $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start=' . $search_accountancy_aux_code_start; $param .= '&search_accountancy_aux_code_start=' . urlencode($search_accountancy_aux_code_start);
} }
if (! empty($search_accountancy_aux_code_end)) { if (! empty($search_accountancy_aux_code_end)) {
$filter['t.subledger_account<='] = $search_accountancy_aux_code_end; $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
$param .= '&search_accountancy_aux_code_end=' . $search_accountancy_aux_code_end; $param .= '&search_accountancy_aux_code_end=' . urlencode($search_accountancy_aux_code_end);
} }
if (! empty($search_mvt_label)) { if (! empty($search_mvt_label)) {
$filter['t.label_operation'] = $search_mvt_label; $filter['t.label_operation'] = $search_mvt_label;
$param .= '&search_mvt_label=' . $search_mvt_label; $param .= '&search_mvt_label=' . urlencode($search_mvt_label);
} }
if (! empty($search_direction)) { if (! empty($search_direction)) {
$filter['t.sens'] = $search_direction; $filter['t.sens'] = $search_direction;
$param .= '&search_direction=' . $search_direction; $param .= '&search_direction=' . urlencode($search_direction);
} }
if (! empty($search_ledger_code)) { if (! empty($search_ledger_code)) {
$filter['t.code_journal'] = $search_ledger_code; $filter['t.code_journal'] = $search_ledger_code;
$param .= '&search_ledger_code=' . $search_ledger_code; $param .= '&search_ledger_code=' . urlencode($search_ledger_code);
} }
if (! empty($search_mvt_num)) { if (! empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num; $filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num=' . $search_mvt_num; $param .= '&search_mvt_num=' . urlencode($search_mvt_num);
} }
if (! empty($search_date_creation_start)) { if (! empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start; $filter['t.date_creation>='] = $search_date_creation_start;
@ -263,11 +265,11 @@ if (! empty($search_date_modification_end)) {
} }
if (! empty($search_debit)) { if (! empty($search_debit)) {
$filter['t.debit'] = $search_debit; $filter['t.debit'] = $search_debit;
$param .= '&search_debit=' . $search_debit; $param .= '&search_debit=' . urlencode($search_debit);
} }
if (! empty($search_credit)) { if (! empty($search_credit)) {
$filter['t.credit'] = $search_credit; $filter['t.credit'] = $search_credit;
$param .= '&search_credit=' . $search_credit; $param .= '&search_credit=' . urlencode($search_credit);
} }
if ($action == 'delbookkeeping') { if ($action == 'delbookkeeping') {
@ -460,11 +462,11 @@ if (! empty($arrayfields['t.doc_date']['checked']))
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('From') . ' '; print $langs->trans('From') . ' ';
print $form->select_date($search_date_start?$search_date_start:-1, 'date_start', 0, 0, 1); print $form->select_date($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1);
print '</div>'; print '</div>';
print '<div class="nowrap">'; print '<div class="nowrap">';
print $langs->trans('to') . ' '; print $langs->trans('to') . ' ';
print $form->select_date($search_date_end?$search_date_end:-1, 'date_end', 0, 0, 1); print $form->select_date($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1);
print '</div>'; print '</div>';
print '</td>'; print '</td>';
} }
@ -612,7 +614,12 @@ if ($num > 0)
// Piece number // Piece number
if (! empty($arrayfields['t.piece_num']['checked'])) if (! empty($arrayfields['t.piece_num']['checked']))
{ {
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>'; print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1,'',0,'',1);
//print '<a href="./card.php?piece_num=' . $line->piece_num . '&save_lastsearch_values=1">' . $line->piece_num . '</a>';
print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }

View File

@ -354,6 +354,67 @@ class BookKeeping extends CommonObject
} }
} }
/**
* Return a link to the object card (with optionaly the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...)
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1)
{
global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = '';
$companylink = '';
$label = '<u>' . $langs->trans("Transaction") . '</u>';
$label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->piece_num;
$url = DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$this->piece_num;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowTransaction");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->piece_num;
$result .= $linkend;
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
return $result;
}
/** /**
* Create object into database * Create object into database
* *
@ -804,13 +865,14 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.tms>=' || $key == 't.tms<=') { } elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} else { } else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere[] = natural_search($key, $value, 0, 1);
} }
} }
} }
$sql.= ' WHERE 1 = 1'; $sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')';
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }

View File

@ -90,12 +90,12 @@ $search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_user = GETPOST('search_user','int'); $search_user = GETPOST('search_user','int');
$search_sale = GETPOST('search_sale','int'); $search_sale = GETPOST('search_sale','int');
$day = GETPOST('day','int'); $search_day = GETPOST('search_day','int');
$month = GETPOST('month','int'); $search_month = GETPOST('search_month','int');
$year = GETPOST('year','int'); $search_year = GETPOST('search_year','int');
$day_lim = GETPOST('day_lim','int'); $search_day_lim = GETPOST('search_day_lim','int');
$month_lim = GETPOST('month_lim','int'); $search_month_lim = GETPOST('search_month_lim','int');
$year_lim = GETPOST('year_lim','int'); $search_year_lim = GETPOST('search_year_lim','int');
$option = GETPOST('search_option'); $option = GETPOST('search_option');
if ($option == 'late') { if ($option == 'late') {
@ -218,14 +218,14 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','a
$search_type=''; $search_type='';
$search_country=''; $search_country='';
$search_type_thirdparty=''; $search_type_thirdparty='';
$day=''; $search_day='';
$year=''; $search_year='';
$month=''; $search_month='';
$option=''; $option='';
$filter=''; $filter='';
$day_lim=''; $search_day_lim='';
$year_lim=''; $search_year_lim='';
$month_lim=''; $search_month_lim='';
$toselect=''; $toselect='';
$search_array_options=array(); $search_array_options=array();
} }
@ -443,31 +443,31 @@ if ($search_status != '' && $search_status >= 0)
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
} }
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
if ($month > 0) if ($search_month > 0)
{ {
if ($year > 0 && empty($day)) if ($search_year > 0 && empty($search_day))
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
else if ($year > 0 && ! empty($day)) else if ($search_year > 0 && ! empty($search_day))
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $serch_year))."'";
else else
$sql.= " AND date_format(f.datef, '%m') = '".$month."'"; $sql.= " AND date_format(f.datef, '%m') = '".$month."'";
} }
else if ($year > 0) else if ($search_year > 0)
{ {
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
} }
if ($month_lim > 0) if ($month_lim > 0)
{ {
if ($year_lim > 0 && empty($day_lim)) if ($search_year_lim > 0 && empty($search_day_lim))
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,$month_lim,false))."' AND '".$db->idate(dol_get_last_day($year_lim,$month_lim,false))."'"; $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,$search_month_lim,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,$search_month_lim,false))."'";
else if ($year_lim > 0 && ! empty($day_lim)) else if ($search_year_lim > 0 && ! empty($search_day_lim))
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'"; $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_lim, $search_day_lim, $search_year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_lim, $search_day_lim, $search_year_lim))."'";
else else
$sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$db->escape($month_lim)."'"; $sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$db->escape($search_month_lim)."'";
} }
else if ($year_lim > 0) else if ($search_year_lim > 0)
{ {
$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($year_lim,12,false))."'"; $sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_get_first_day($search_year_lim,1,false))."' AND '".$db->idate(dol_get_last_day($search_year_lim,12,false))."'";
} }
if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
@ -538,12 +538,12 @@ if ($resql)
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.='&sall='.urlencode($sall); if ($sall) $param.='&sall='.urlencode($sall);
if ($day) $param.='&day='.urlencode($day); if ($search_day) $param.='&search_day='.urlencode($search_day);
if ($month) $param.='&month='.urlencode($month); if ($search_month) $param.='&search_month='.urlencode($search_month);
if ($year) $param.='&year=' .urlencode($year); if ($search_year) $param.='&search_year=' .urlencode($search_year);
if ($day_lim) $param.='&day_lim='.urlencode($day_lim); if ($search_day_lim) $param.='&search_day_lim='.urlencode($search_day_lim);
if ($month_lim) $param.='&month_lim='.urlencode($month_lim); if ($search_month_lim) $param.='&search_month_lim='.urlencode($search_month_lim);
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim);
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
if ($search_type != '') $param.='&search_type='.urlencode($search_type); if ($search_type != '') $param.='&search_type='.urlencode($search_type);
@ -558,9 +558,9 @@ if ($resql)
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_status != '') $param.='&search_status='.urlencode($search_status);
if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode);
if ($show_files) $param.='&show_files=' .$show_files; if ($show_files) $param.='&show_files='.urlencode($show_files);
if ($option) $param.="&search_option=".$option; if ($option) $param.="&search_option=".urlencode($option);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -707,18 +707,18 @@ if ($resql)
if (! empty($arrayfields['f.date']['checked'])) if (! empty($arrayfields['f.date']['checked']))
{ {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">'; print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '</td>'; print '</td>';
} }
// Date due // Date due
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{ {
print '<td class="liste_titre nowraponall" align="center">'; print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="month_lim" value="'.dol_escape_htmltag($month_lim).'">'; print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
$formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); $formother->select_year($search_year_lim?$search_year_lim:-1,'search_year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late"); print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
print '</td>'; print '</td>';
} }

View File

@ -55,12 +55,12 @@ $confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist'; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
$orderyear=GETPOST("orderyear","int"); $search_orderyear=GETPOST("search_orderyear","int");
$ordermonth=GETPOST("ordermonth","int"); $search_ordermonth=GETPOST("search_ordermonth","int");
$orderday=GETPOST("orderday","int"); $search_orderday=GETPOST("search_orderday","int");
$deliveryyear=GETPOST("deliveryyear","int"); $search_deliveryyear=GETPOST("search_deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int"); $search_deliverymonth=GETPOST("search_deliverymonth","int");
$deliveryday=GETPOST("deliveryday","int"); $search_deliveryday=GETPOST("search_deliveryday","int");
$sall=GETPOST('search_all', 'alphanohtml'); $sall=GETPOST('search_all', 'alphanohtml');
$search_product_category=GETPOST('search_product_category','int'); $search_product_category=GETPOST('search_product_category','int');
@ -181,9 +181,6 @@ if (empty($reshook))
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{ {
$ordermonth='';
$orderyear='';
$orderday='';
$search_categ=''; $search_categ='';
$search_user=''; $search_user='';
$search_sale=''; $search_sale='';
@ -203,12 +200,12 @@ if (empty($reshook))
$search_total_ttc=''; $search_total_ttc='';
$search_project_ref=''; $search_project_ref='';
$search_status=-1; $search_status=-1;
$orderyear=''; $search_orderyear='';
$ordermonth=''; $search_ordermonth='';
$orderday=''; $search_orderday='';
$deliveryday=''; $search_deliveryday='';
$deliverymonth=''; $search_deliverymonth='';
$deliveryyear=''; $search_deliveryyear='';
$billed=''; $billed='';
$search_billed=''; $search_billed='';
$toselect=''; $toselect='';
@ -524,7 +521,7 @@ if ($search_refsupp) $sql.= natural_search("cf.ref_supplier", $search_refsupp);
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname','u.login'), $search_request_author) ; if ($search_request_author) $sql.=natural_search(array('u.lastname','u.firstname','u.login'), $search_request_author) ;
if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$search_billed; if ($search_billed != '' && $search_billed >= 0) $sql .= " AND cf.billed = ".$db->escape($search_billed);
//Required triple check because statut=0 means draft filter //Required triple check because statut=0 means draft filter
if (GETPOST('statut', 'intcomma') !== '') if (GETPOST('statut', 'intcomma') !== '')
@ -535,31 +532,31 @@ if ($search_status != '' && $search_status >= 0)
{ {
$sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")";
} }
if ($ordermonth > 0) if ($search_ordermonth > 0)
{ {
if ($orderyear > 0 && empty($orderday)) if ($search_orderyear > 0 && empty($search_orderday))
$sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,$ordermonth,false))."' AND '".$db->idate(dol_get_last_day($orderyear,$ordermonth,false))."'"; $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,$search_ordermonth,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,$search_ordermonth,false))."'";
else if ($orderyear > 0 && ! empty($orderday)) else if ($search_orderyear > 0 && ! empty($search_orderday))
$sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $ordermonth, $orderday, $orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $ordermonth, $orderday, $orderyear))."'"; $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_ordermonth, $search_orderday, $search_orderyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_ordermonth, $search_orderday, $search_orderyear))."'";
else else
$sql.= " AND date_format(cf.date_commande, '%m') = '".$ordermonth."'"; $sql.= " AND date_format(cf.date_commande, '%m') = '".$db->escape($search_ordermonth)."'";
} }
else if ($orderyear > 0) else if ($search_orderyear > 0)
{ {
$sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($orderyear,12,false))."'"; $sql.= " AND cf.date_commande BETWEEN '".$db->idate(dol_get_first_day($search_orderyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_orderyear,12,false))."'";
} }
if ($deliverymonth > 0) if ($search_deliverymonth > 0)
{ {
if ($deliveryyear > 0 && empty($deliveryday)) if ($search_deliveryyear > 0 && empty($search_deliveryday))
$sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,$deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,$deliverymonth,false))."'"; $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,$search_deliverymonth,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,$search_deliverymonth,false))."'";
else if ($deliveryyear > 0 && ! empty($deliveryday)) else if ($search_deliveryyear > 0 && ! empty($search_deliveryday))
$sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $deliverymonth, $deliveryday, $deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $deliverymonth, $deliveryday, $deliveryyear))."'"; $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_eliverymonth, $search_deliveryday, $search_deliveryyear))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_deliverymonth, $search_deliveryday, $search_deliveryyear))."'";
else else
$sql.= " AND date_format(cf.date_livraison, '%m') = '".$deliverymonth."'"; $sql.= " AND date_format(cf.date_livraison, '%m') = '".$db->escape($search_deliverymonth)."'";
} }
else if ($deliveryyear > 0) else if ($search_deliveryyear > 0)
{ {
$sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'"; $sql.= " AND cf.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($search_deliveryyear,12,false))."'";
} }
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
@ -614,12 +611,12 @@ if ($resql)
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&search_all=".$sall; if ($sall) $param.="&search_all=".$sall;
if ($orderday) $param.='&orderday='.$orderday; if ($search_orderday) $param.='&search_orderday='.$search_orderday;
if ($ordermonth) $param.='&ordermonth='.$ordermonth; if ($search_ordermonth) $param.='&search_ordermonth='.$search_ordermonth;
if ($orderyear) $param.='&orderyear='.$orderyear; if ($search_orderyear) $param.='&search_orderyear='.$search_orderyear;
if ($deliveryday) $param.='&deliveryday='.$deliveryday; if ($search_deliveryday) $param.='&search_deliveryday='.$search_deliveryday;
if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth; if ($search_deliverymonth) $param.='&search_deliverymonth='.$search_deliverymonth;
if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear; if ($search_deliveryyear) $param.='&search_deliveryyear='.$search_deliveryyear;
if ($search_ref) $param.='&search_ref='.$search_ref; if ($search_ref) $param.='&search_ref='.$search_ref;
if ($search_company) $param.='&search_company='.$search_company; if ($search_company) $param.='&search_company='.$search_company;
if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_user > 0) $param.='&search_user='.$search_user;
@ -822,18 +819,18 @@ if ($resql)
if (! empty($arrayfields['cf.date_commande']['checked'])) if (! empty($arrayfields['cf.date_commande']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="orderday" value="'.$orderday.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_orderday" value="'.$search_orderday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="ordermonth" value="'.$ordermonth.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_ordermonth" value="'.$search_ordermonth.'">';
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); $formother->select_year($search_orderyear?$search_orderyear:-1,'search_orderyear',1, 20, 5);
print '</td>'; print '</td>';
} }
// Date delivery // Date delivery
if (! empty($arrayfields['cf.date_delivery']['checked'])) if (! empty($arrayfields['cf.date_delivery']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_deliveryday" value="'.$search_deliveryday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_deliverymonth" value="'.$search_deliverymonth.'">';
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); $formother->select_year($search_deliveryyear?$search_deliveryyear:-1,'search_deliveryyear',1, 20, 5);
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['cf.total_ht']['checked'])) if (! empty($arrayfields['cf.total_ht']['checked']))

View File

@ -703,32 +703,33 @@ if (! defined('NOLOGIN'))
} }
else else
{ {
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('main')); $hookmanager->initHooks(array('main'));
// Code for search criteria persistence. // Code for search criteria persistence.
if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here
{ {
$relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]);
$relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server
// Clean $relativepathstring // Clean $relativepathstring
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring); $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
//var_dump($relativepathstring); //var_dump($relativepathstring);
if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) // We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp
{ if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring]))
$_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; {
unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring];
} unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
} }
}
$action = ''; $action = '';
$reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action);
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} }
} }
} }
@ -1900,8 +1901,8 @@ if (! function_exists("llxFooter"))
// Clean data // Clean data
foreach($user->lastsearch_values_tmp as $key => $val) foreach($user->lastsearch_values_tmp as $key => $val)
{ {
unset($_SESSION['lastsearch_values_tmp_'.$key]); unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean arry to rebuild it just after
if (count($val)) if (count($val) && empty($_POST['button_removefilter'])) // If there is search criteria to save and we did not click on 'Clear filter' button
{ {
if (empty($val['sortfield'])) unset($val['sortfield']); if (empty($val['sortfield'])) unset($val['sortfield']);
if (empty($val['sortorder'])) unset($val['sortorder']); if (empty($val['sortorder'])) unset($val['sortorder']);

View File

@ -278,6 +278,7 @@ input.select2-input {
.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month],
.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
.liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create],
.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when],
.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] .liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end]
{ {

View File

@ -291,6 +291,7 @@ textarea.cke_source:focus
.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month],
.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
.liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create],
.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when],
.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] .liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end]
{ {