From aad99bdcc096c5f758e8e7d7382dbe13c38c5c40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Apr 2018 22:27:42 +0200 Subject: [PATCH 1/5] FIX Removed error when no error on accounting setup page --- htdocs/accountancy/admin/index.php | 43 +++++++++--------------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index ec1b20b15e9..44c816530dd 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -27,9 +27,8 @@ * \ingroup Advanced accountancy * \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/accounting.lib.php'; @@ -65,39 +64,23 @@ $accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : if ($action == 'update') { $error = 0; - $accounting_modes = array ( - 'RECETTES-DEPENSES', - 'CREANCES-DETTES' - ); + if (! $error) + { + foreach ($list as $constname) + { + $constvalue = GETPOST($constname, 'alpha'); - $accounting_mode = GETPOST('accounting_mode', 'alpha'); - - if (in_array($accounting_mode, $accounting_modes)) { - - if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { - $error ++; - } - } else { - $error ++; + if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + if ($error) { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } - 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) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'errors'); } } From 8cca3dabd6c1574344514837134a02075da09d1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Apr 2018 11:29:30 +0200 Subject: [PATCH 2/5] FIX look and feel v7 "back to" for bookkeeping record --- htdocs/accountancy/bookkeeping/card.php | 37 +++++------ htdocs/accountancy/bookkeeping/list.php | 19 +++--- .../accountancy/class/bookkeeping.class.php | 61 +++++++++++++++++++ 3 files changed, 93 insertions(+), 24 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index e9f50e77715..9dcb924779e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -36,26 +36,28 @@ $langs->load("accountancy"); $langs->load("bills"); $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 -$id = GETPOST('id', 'int'); if ($user->societe_id > 0) { accessforbidden(); } -$action = GETPOST('action','aZ09'); -$mode = GETPOST('mode','aZ09'); // '' or 'tmp' -$piece_num = GETPOST("piece_num"); $mesg = ''; -$account_number = GETPOST('account_number'); -$subledger_account = GETPOST('subledger_account'); +$account_number = GETPOST('account_number','alphanohtml'); +$subledger_account = GETPOST('subledger_account','alphanohtml'); if ($subledger_account == - 1) { $subledger_account = null; } -$label_compte = GETPOST('label_compte'); -$label_operation= GETPOST('label_operation'); -$debit = price2num(GETPOST('debit')); -$credit = price2num(GETPOST('credit')); +$label_compte = GETPOST('label_compte','alphanohtml'); +$label_operation= GETPOST('label_operation','alphanohtml'); +$debit = price2num(GETPOST('debit','alpha')); +$credit = price2num(GETPOST('credit','alpha')); $save = GETPOST('save','alpha'); if (! empty($save)) $action = 'add'; @@ -340,13 +342,14 @@ if ($action == 'create') dol_fiche_head(); print ''; - print ''; + + /*print ''; print ''; print ''; - print ''; + print '';*/ print ''; - print ''; + print ''; print ''; @@ -389,7 +392,7 @@ if ($action == 'create') if (! empty($book->piece_num)) { - $backlink = '' . $langs->trans('BackToList') . ''; + $backlink = '' . $langs->trans('BackToList') . ''; print load_fiche_titre($langs->trans("UpdateMvts"), $backlink); @@ -594,7 +597,7 @@ if ($action == 'create') print "\n"; - foreach ( $book->linesmvt as $line ) { + foreach ($book->linesmvt as $line) { print ''; $total_debit += $line->debit; $total_credit += $line->credit; @@ -673,8 +676,8 @@ if ($action == 'create') print ''; } print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ad8be2608c1..7f9509921f9 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -39,8 +39,8 @@ $action = GETPOST('action', 'alpha'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_doc_type = GETPOST("search_doc_type"); $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_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', '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('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_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')); @@ -181,12 +181,12 @@ $filter = array (); if (! empty($search_date_start)) { $filter['t.doc_date>='] = $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)) { $filter['t.doc_date<='] = $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)) { $filter['t.doc_date'] = $search_doc_date; @@ -460,11 +460,11 @@ if (! empty($arrayfields['t.doc_date']['checked'])) print ''; } @@ -612,7 +612,12 @@ if ($num > 0) // Piece number if (! empty($arrayfields['t.piece_num']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 7e29262324f..a1c4ba080ee 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -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 = '' . $langs->trans("Transaction") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $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 = ''; + $linkend=''; + + $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 * From 560c84be0ded221db019bf900723b8cfbc73891a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Apr 2018 12:40:19 +0200 Subject: [PATCH 3/5] FIX When clearing filter, we must not save tmp criterias in session --- htdocs/main.inc.php | 51 +++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 629e0108045..a8b3defe434 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -682,32 +682,33 @@ if (! defined('NOLOGIN')) } else { - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context - $hookmanager->initHooks(array('main')); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + $hookmanager->initHooks(array('main')); - // Code for search criteria persistence. - if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here - { - $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); - $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server - // Clean $relativepathstring - if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); - $relativepathstring = preg_replace('/^\//', '', $relativepathstring); - $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); - //var_dump($relativepathstring); + // Code for search criteria persistence. + if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here + { + $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); + $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server + // Clean $relativepathstring + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + //var_dump($relativepathstring); - if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) - { - $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; - unset($_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]); + } + } - $action = ''; - $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } + $action = ''; + $reshook = $hookmanager->executeHooks('updateSession', array(), $user, $action); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } } } @@ -1882,8 +1883,8 @@ if (! function_exists("llxFooter")) // Clean data foreach($user->lastsearch_values_tmp as $key => $val) { - unset($_SESSION['lastsearch_values_tmp_'.$key]); - if (count($val)) + unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean arry to rebuild it just after + 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['sortorder'])) unset($val['sortorder']); From 3d36e3ee49e6524c11c2b47dd7867f92b7f005fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Apr 2018 12:41:03 +0200 Subject: [PATCH 4/5] Fix search criteria in bookkeeping table --- htdocs/accountancy/bookkeeping/list.php | 32 ++++++++++--------- .../accountancy/class/bookkeeping.class.php | 7 ++-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 7f9509921f9..57f52a4a77f 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -75,6 +75,8 @@ if ($search_accountancy_aux_code_end == - 1) { } $search_mvt_label = GETPOST('search_mvt_label', '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'); // 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 (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.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; @@ -195,51 +197,51 @@ if (! empty($search_doc_date)) { } if (! empty($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)) { $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)) { $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)) { $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)) { $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)) { $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)) { $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)) { $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)) { $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)) { $filter['t.sens'] = $search_direction; - $param .= '&search_direction=' . $search_direction; + $param .= '&search_direction=' . urlencode($search_direction); } if (! empty($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)) { $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)) { $filter['t.date_creation>='] = $search_date_creation_start; @@ -263,11 +265,11 @@ if (! empty($search_date_modification_end)) { } if (! empty($search_debit)) { $filter['t.debit'] = $search_debit; - $param .= '&search_debit=' . $search_debit; + $param .= '&search_debit=' . urlencode($search_debit); } if (! empty($search_credit)) { $filter['t.credit'] = $search_credit; - $param .= '&search_credit=' . $search_credit; + $param .= '&search_credit=' . urlencode($search_credit); } if ($action == 'delbookkeeping') { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a1c4ba080ee..0ad91a30f56 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -865,13 +865,14 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; } elseif ($key == 't.tms>=' || $key == 't.tms<=') { $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; + } elseif ($key == 't.credit' || $key == 't.debit') { + $sqlwhere[] = natural_search($key, $value, 1, 1); } else { - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + $sqlwhere[] = natural_search($key, $value, 0, 1); } } } - $sql.= ' WHERE 1 = 1'; - $sql .= " AND entity IN (" . getEntity('accountancy') . ")"; + $sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')'; if (count($sqlwhere) > 0) { $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); } From 79af10fc8371af7c1d90e9310e36df2f61385590 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 8 Apr 2018 13:01:42 +0200 Subject: [PATCH 5/5] Fix search filters --- htdocs/compta/facture/list.php | 82 +++++++++++++++---------------- htdocs/fourn/commande/list.php | 87 ++++++++++++++++----------------- htdocs/theme/eldy/style.css.php | 1 + htdocs/theme/md/style.css.php | 1 + 4 files changed, 85 insertions(+), 86 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 880a18d501a..7dfd39171e9 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -89,12 +89,12 @@ $search_country=GETPOST("search_country",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); $search_user = GETPOST('search_user','int'); $search_sale = GETPOST('search_sale','int'); -$day = GETPOST('day','int'); -$month = GETPOST('month','int'); -$year = GETPOST('year','int'); -$day_lim = GETPOST('day_lim','int'); -$month_lim = GETPOST('month_lim','int'); -$year_lim = GETPOST('year_lim','int'); +$search_day = GETPOST('search_day','int'); +$search_month = GETPOST('search_month','int'); +$search_year = GETPOST('search_year','int'); +$search_day_lim = GETPOST('search_day_lim','int'); +$search_month_lim = GETPOST('search_month_lim','int'); +$search_year_lim = GETPOST('search_year_lim','int'); $option = GETPOST('option'); if ($option == 'late') { @@ -219,14 +219,14 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','a $search_type=''; $search_country=''; $search_type_thirdparty=''; - $day=''; - $year=''; - $month=''; + $search_day=''; + $search_year=''; + $search_month=''; $option=''; $filter=''; - $day_lim=''; - $year_lim=''; - $month_lim=''; + $search_day_lim=''; + $search_year_lim=''; + $search_month_lim=''; $toselect=''; $search_array_options=array(); } @@ -444,31 +444,31 @@ if ($search_status != '' && $search_status >= 0) 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 ($month > 0) +if ($search_month > 0) { - if ($year > 0 && empty($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))."'"; - else if ($year > 0 && ! empty($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))."'"; + if ($search_year > 0 && empty($search_day)) + $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 ($search_year > 0 && ! empty($search_day)) + $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 $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 ($year_lim > 0 && empty($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))."'"; - else if ($year_lim > 0 && ! empty($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))."'"; + if ($search_year_lim > 0 && empty($search_day_lim)) + $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 ($search_year_lim > 0 && ! empty($search_day_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 - $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 ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; @@ -539,12 +539,12 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall) $param.='&sall='.urlencode($sall); - if ($day) $param.='&day='.urlencode($day); - if ($month) $param.='&month='.urlencode($month); - if ($year) $param.='&year=' .urlencode($year); - if ($day_lim) $param.='&day_lim='.urlencode($day_lim); - if ($month_lim) $param.='&month_lim='.urlencode($month_lim); - if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); + if ($search_day) $param.='&search_day='.urlencode($search_day); + if ($search_month) $param.='&search_month='.urlencode($search_month); + if ($search_year) $param.='&search_year=' .urlencode($search_year); + if ($search_day_lim) $param.='&search_day_lim='.urlencode($search_day_lim); + if ($search_month_lim) $param.='&search_month_lim='.urlencode($search_month_lim); + if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim); if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); if ($search_type != '') $param.='&search_type='.urlencode($search_type); @@ -559,9 +559,9 @@ if ($resql) if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); - if ($show_files) $param.='&show_files=' .$show_files; - if ($option) $param.="&option=".$option; - if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($option) $param.="&option=".urlencode($option); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -702,18 +702,18 @@ if ($resql) if (! empty($arrayfields['f.date']['checked'])) { print ''; } // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { print ''; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index ef5f8816a94..aff104cf25f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -54,12 +54,12 @@ $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); -$orderyear=GETPOST("orderyear","int"); -$ordermonth=GETPOST("ordermonth","int"); -$orderday=GETPOST("orderday","int"); -$deliveryyear=GETPOST("deliveryyear","int"); -$deliverymonth=GETPOST("deliverymonth","int"); -$deliveryday=GETPOST("deliveryday","int"); +$search_orderyear=GETPOST("search_orderyear","int"); +$search_ordermonth=GETPOST("search_ordermonth","int"); +$search_orderday=GETPOST("search_orderday","int"); +$search_deliveryyear=GETPOST("search_deliveryyear","int"); +$search_deliverymonth=GETPOST("search_deliverymonth","int"); +$search_deliveryday=GETPOST("search_deliveryday","int"); $sall=GETPOST('search_all', 'alphanohtml'); $search_product_category=GETPOST('search_product_category','int'); @@ -182,9 +182,6 @@ if (empty($reshook)) // 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 { - $ordermonth=''; - $orderyear=''; - $orderday=''; $search_categ=''; $search_user=''; $search_sale=''; @@ -204,12 +201,12 @@ if (empty($reshook)) $search_total_ttc=''; $search_project_ref=''; $search_status=-1; - $orderyear=''; - $ordermonth=''; - $orderday=''; - $deliveryday=''; - $deliverymonth=''; - $deliveryyear=''; + $search_orderyear=''; + $search_ordermonth=''; + $search_orderday=''; + $search_deliveryday=''; + $search_deliverymonth=''; + $search_deliveryyear=''; $billed=''; $search_billed=''; $toselect=''; @@ -525,7 +522,7 @@ if ($search_refsupp) $sql.= natural_search("cf.ref_supplier", $search_refsupp); if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); 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_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 if (GETPOST('statut', 'intcomma') !== '') @@ -536,31 +533,31 @@ if ($search_status != '' && $search_status >= 0) { $sql.=" AND cf.fk_statut IN (".$db->escape($search_status).")"; } -if ($ordermonth > 0) +if ($search_ordermonth > 0) { - if ($orderyear > 0 && empty($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))."'"; - else if ($orderyear > 0 && ! empty($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))."'"; + if ($search_orderyear > 0 && empty($search_orderday)) + $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 ($search_orderyear > 0 && ! empty($search_orderday)) + $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 - $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)) - $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))."'"; - else if ($deliveryyear > 0 && ! empty($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))."'"; - else - $sql.= " AND date_format(cf.date_livraison, '%m') = '".$deliverymonth."'"; + if ($search_deliveryyear > 0 && empty($search_deliveryday)) + $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 ($search_deliveryyear > 0 && ! empty($search_deliveryday)) + $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 + $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_zip) $sql.= natural_search("s.zip",$search_zip); @@ -615,12 +612,12 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall) $param.="&search_all=".$sall; - if ($orderday) $param.='&orderday='.$orderday; - if ($ordermonth) $param.='&ordermonth='.$ordermonth; - if ($orderyear) $param.='&orderyear='.$orderyear; - if ($deliveryday) $param.='&deliveryday='.$deliveryday; - if ($deliverymonth) $param.='&deliverymonth='.$deliverymonth; - if ($deliveryyear) $param.='&deliveryyear='.$deliveryyear; + if ($search_orderday) $param.='&search_orderday='.$search_orderday; + if ($search_ordermonth) $param.='&search_ordermonth='.$search_ordermonth; + if ($search_orderyear) $param.='&search_orderyear='.$search_orderyear; + if ($search_deliveryday) $param.='&search_deliveryday='.$search_deliveryday; + if ($search_deliverymonth) $param.='&search_deliverymonth='.$search_deliverymonth; + if ($search_deliveryyear) $param.='&search_deliveryyear='.$search_deliveryyear; if ($search_ref) $param.='&search_ref='.$search_ref; if ($search_company) $param.='&search_company='.$search_company; if ($search_user > 0) $param.='&search_user='.$search_user; @@ -818,18 +815,18 @@ if ($resql) if (! empty($arrayfields['cf.date_commande']['checked'])) { print ''; } // Date delivery if (! empty($arrayfields['cf.date_delivery']['checked'])) { print ''; } if (! empty($arrayfields['cf.total_ht']['checked'])) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 6a3daaf6cfb..e7a9250c6cf 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -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=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=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_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c36edde7ddc..eff7b98e8c5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -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=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=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_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] {
' . $langs->trans("NumPiece") . '' . $next_num_mvt . '
' . $langs->trans("Docdate") . '' . $langs->trans("Docdate") . ''; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '
'; print '
'; 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 '
'; print '
'; 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 '
'; print '
' . $line->piece_num . ''; + $object->id = $line->id; + $object->piece_num = $line->piece_num; + print $object->getNomUrl(1,'',0,'',1); + //print '' . $line->piece_num . ''; + print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'width75'); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'width75'); print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'width75'); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_year_lim?$search_year_lim:-1,'search_year_lim',1, 20, 5, 0, 0, '', 'width75'); print '
'.$langs->trans("Late"); print '
'; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_orderyear?$search_orderyear:-1,'search_orderyear',1, 20, 5); print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_deliveryyear?$search_deliveryyear:-1,'search_deliveryyear',1, 20, 5); print '