From 5191bffb1c4cafd19aeeef934bf48c37bf1a4bf8 Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Wed, 13 May 2015 18:56:13 +0100 Subject: [PATCH 01/16] improve events list view provide a finer grained view for this list and fix bug related to sorting control which wipes off other parameters --- htdocs/admin/tools/listevents.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 373b46c6062..fff66571517 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Bahfir Abbes * * 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 @@ -59,6 +60,22 @@ $search_user = GETPOST("search_user"); $search_desc = GETPOST("search_desc"); $search_ua = GETPOST("search_ua"); +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +$params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua"; +$params.= "&date_startmonth=".$_REQUEST["date_startmonth"]; +$params.= "&date_startday=".$_REQUEST["date_startday"]; +$params.= "&date_startyear=".$_REQUEST["date_startyear"]; +$params.= "&date_endmonth=".$_REQUEST["date_endmonth"]; +$params.= "&date_endday=".$_REQUEST["date_endday"]; +$params.= "&date_endyear=".$_REQUEST["date_endyear"]; + +if (empty($date_start) || empty($date_end)) // We define date_start and date_end +{ + $date_start=mktime(0,0,0,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); + $date_end=mktime(23,59,59,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); +} + /* * Actions @@ -124,6 +141,7 @@ $sql.= " u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")"; +$sql.= " AND e.dateevent >= '".$db->idate($date_start)."' AND e.dateevent <= '".$db->idate($date_end)."'"; if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$db->escape($search_code)."%'"; } if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$db->escape($search_ip)."%'"; } if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$db->escape($search_user)."%'"; } @@ -145,7 +163,8 @@ if ($result) if ($search_desc) $param.='&search_desc='.$search_desc; if ($search_ua) $param.='&search_ua='.$search_ua; - print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); + $langs->load('withdrawals'); + print_barre_liste($langs->trans("ListOfSecurityEvents").' : '.$num.' '.strtolower($langs->trans("Lines")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, 0, 'setup'); if ($action == 'purge') { @@ -168,7 +187,7 @@ if ($result) print '
'; print ''; - print ' '; + print ''.$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).$form->select_date($date_end,'date_end',0,0,0,'',1,0,1).''; print ''; print ''; From ffc5284a7875041d97d1618d2f06eeda0ebdbc6a Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Thu, 14 May 2015 20:17:52 +0100 Subject: [PATCH 02/16] Update listevents.php --- htdocs/admin/tools/listevents.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index fff66571517..33fba65cecc 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -62,6 +62,11 @@ $search_ua = GETPOST("search_ua"); $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); + +// checks: if date_start<0 then date_start=01/01/1970 and if date_start>date_end then date_end=date_start + 24 hours +if($date_start<0) $date_start=0; +if($date_start>$date_end) $date_end=$date_start+86400; + $params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua"; $params.= "&date_startmonth=".$_REQUEST["date_startmonth"]; $params.= "&date_startday=".$_REQUEST["date_startday"]; @@ -72,8 +77,8 @@ $params.= "&date_endyear=".$_REQUEST["date_endyear"]; if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $date_start=mktime(0,0,0,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); - $date_end=mktime(23,59,59,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); + $date_start=dol_mktime(0,0,0,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); + $date_end=dol_mktime(23,59,59,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); } From 1ba2240553e1403cb7204fafd1ff30c775a5e129 Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Sun, 17 May 2015 16:13:50 +0100 Subject: [PATCH 03/16] fix add to listevents.php use of dol_mktime + check dates order --- htdocs/admin/tools/listevents.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 33fba65cecc..e894bd94f58 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -63,8 +63,7 @@ $search_ua = GETPOST("search_ua"); $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); -// checks: if date_start<0 then date_start=01/01/1970 and if date_start>date_end then date_end=date_start + 24 hours -if($date_start<0) $date_start=0; +// checks:if date_start>date_end then date_end=date_start + 24 hours if($date_start>$date_end) $date_end=$date_start+86400; $params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua"; From 28e973331bfc8529dc599dd47a39c40a357a1644 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 18 May 2015 18:42:14 +0200 Subject: [PATCH 04/16] Fix: update supplier orderline + rm deprecated prop - Fix SQL error in update supplier orderline - Remove deprecated $libelle from product class, $libelle is removed from code and can not be used anymore, no sense to mark deprecated. - Add missing translation key --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/langs/en_US/errors.lang | 1 + htdocs/product/class/product.class.php | 6 ------ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b1b9e74266e..ccd17a2f97b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2066,7 +2066,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ",total_localtax2='".price2num($total_localtax2)."'"; $sql.= ",total_ttc='".price2num($total_ttc)."'"; $sql.= ",product_type=".$type; - $sql.= ($fk_unit ? "'".$this->db->escape($fk_unit)."'":"null"); + $sql.= ($fk_unit ? ",fk_unit='".$this->db->escape($fk_unit)."'":", fk_unit=null"); $sql.= " WHERE rowid = ".$rowid; dol_syslog(get_class($this)."::updateline", LOG_DEBUG); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4266107d8a3..9a878366bc7 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -170,6 +170,7 @@ ErrorGlobalVariableUpdater4=SOAP client failed with error '%s' ErrorGlobalVariableUpdater5=No global variable selected ErrorFieldMustBeANumeric=Field %s must be a numeric value ErrorFieldMustBeAnInteger=Field %s must be an integer +ErrorMandatoryParametersNotProvided=Mandatory parameter(s) not provided # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b2df143e185..b9ceb7c240a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -59,12 +59,6 @@ class Product extends CommonObject var $id ; //! Ref var $ref; - /** - * Product label - * @var string - * @deprecated use $label - */ - var $libelle; /** * Product label * @var string From e230d72cea2e185e62fbefaa5cfcd4f80169c96b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 May 2015 19:41:23 +0200 Subject: [PATCH 05/16] Increase default date range to current month instead of current day --- htdocs/admin/tools/listevents.php | 21 ++++++++++++++------- htdocs/core/lib/functions.lib.php | 17 ++--------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index e894bd94f58..72280ec7220 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015 Bahfir Abbes +/* Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Bahfir Abbes * * 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 @@ -25,6 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (! $user->admin) accessforbidden(); @@ -64,7 +65,10 @@ $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startd $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); // checks:if date_start>date_end then date_end=date_start + 24 hours -if($date_start>$date_end) $date_end=$date_start+86400; +if ($date_start > $date_end) $date_end=$date_start+86400; + +$now = dol_now(); +$nowarray = dol_getdate($now); $params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua"; $params.= "&date_startmonth=".$_REQUEST["date_startmonth"]; @@ -74,10 +78,13 @@ $params.= "&date_endmonth=".$_REQUEST["date_endmonth"]; $params.= "&date_endday=".$_REQUEST["date_endday"]; $params.= "&date_endyear=".$_REQUEST["date_endyear"]; -if (empty($date_start) || empty($date_end)) // We define date_start and date_end +if (empty($date_start)) // We define date_start and date_end { - $date_start=dol_mktime(0,0,0,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); - $date_end=dol_mktime(23,59,59,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); + $date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false); +} +if (empty($date_end)) +{ + $date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f067dcaf417..194a6b3c3bb 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1127,19 +1127,6 @@ function dol_getdate($timestamp,$fast=false) else { $arrayinfo=getdate($timestamp); - - /*$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; - if($startday==1) - { - if ($arrayinfo["wday"]==0) - { - $arrayinfo["wday"]=6; - } - else - { - $arrayinfo["wday"]=$arrayinfo["wday"]-1; - } - }*/ } return $arrayinfo; @@ -2886,14 +2873,14 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr print '