From 8719f877810f30293ea22fc6997421668c8a5989 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Aug 2012 08:12:51 +0200 Subject: [PATCH 1/5] Fix: avoid warning "is not a legal ECMA-262 octal constant" --- htdocs/core/datepicker.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 4db6de685ac..daf63f06d19 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -232,8 +232,8 @@ function displayBox($selectedDate,$month,$year) // Sur click dans calendrier, appelle fonction dpClickDay echo "trans("FormatDateShortJava")."')\""; + echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\""; + echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJava")."')\""; echo ">".sprintf("%02s",$mydate["mday"]).""; $cols++; @@ -278,4 +278,4 @@ function displayBox($selectedDate,$month,$year) \ No newline at end of file +?> From 1aa26d0cd72028e96901963f6700f1acbc1bc163 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Aug 2012 08:45:39 +0200 Subject: [PATCH 2/5] Fix: missing show field if "in progress" is chosen first --- htdocs/core/class/html.formactions.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 27f224551a4..931bf1a8a3d 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2011 Regis Houssin + * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -78,7 +78,7 @@ class FormActions jQuery('#val'+htmlname).change(function() { select_status(); }); - + select_status(); }); @@ -100,6 +100,7 @@ class FormActions } else { jQuery('input[name=percentageshown]').removeAttr('disabled'); + jQuery('.hideifna').show(); } } \n"; From c6d008fb1b3b246148914970f07c35359632e45f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Aug 2012 09:40:59 +0200 Subject: [PATCH 3/5] Fix: broken feature and add FIXME --- htdocs/core/class/html.formactions.class.php | 51 ++++++++++---------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 931bf1a8a3d..1e9868e050c 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -65,42 +65,43 @@ class FormActions '100' => $langs->trans("ActionDoneShort") ); - if ($conf->use_javascript_ajax) + if (! empty($conf->use_javascript_ajax)) { print "\n"; print "\n"; @@ -111,9 +112,9 @@ class FormActions } print ''; if ($selected == 0 || $selected == 100) $canedit=0; - print ' =0)?'':' disabled="disabled"').'>'; + print ' =0)?'':' disabled="disabled"').'>'; print '%'; - print ' '; + //print ' '; } else { From 5dc10cfcae49b9398fa9496cf61005b6c4abd4d5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Aug 2012 10:38:48 +0200 Subject: [PATCH 4/5] Fix: possibility to defined another value instead 50% --- htdocs/comm/action/fiche.php | 4 ++-- htdocs/core/class/html.formactions.class.php | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 46d9ecd5242..b41e4b2ae01 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -478,14 +478,14 @@ if ($action == 'create') print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print ''; $percent=-1; - if (isset($_GET['percentage']) || isset($_POST['percentage'])) + if (GETPOST('percentage')) { $percent=GETPOST('percentage'); } else { if (GETPOST("afaire") == 1) $percent=0; - if (GETPOST("afaire") == 2) $percent=100; + else if (GETPOST("afaire") == 2) $percent=100; } print $htmlactions->form_select_status_action('formaction',$percent,1,'complete'); print ''; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 1e9868e050c..cf63c366792 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -84,18 +84,22 @@ class FormActions }); function select_status() { - var selected = $('#select' + htmlname).val(); + var defaultvalue = $('#select' + htmlname).val(); var percentage = $('input[name=percentage]'); - percentage.val((selected>=0?selected:'')); - if (selected == -1) { + var selected = '".(isset($selected)?$selected:'')."'; + var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:'')); + + percentage.val(value); + + if (defaultvalue == -1) { percentage.attr('disabled', 'disabled'); $('.hideifna').hide(); } - else if (selected == 0) { + else if (defaultvalue == 0) { percentage.attr('disabled', 'disabled'); $('.hideifna').show(); } - else if (selected == 100) { + else if (defaultvalue == 100) { percentage.attr('disabled', 'disabled'); $('.hideifna').show(); } @@ -108,13 +112,12 @@ class FormActions print ''; if ($selected == 0 || $selected == 100) $canedit=0; print ' =0)?'':' disabled="disabled"').'>'; print '%'; - //print ' '; } else { From 7c623a9a2e94b7ef34c9fc7739f56445df410df3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Aug 2012 11:04:56 +0200 Subject: [PATCH 5/5] Fix: strict mode bounty --- htdocs/comm/action/fiche.php | 41 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index b41e4b2ae01..ff73c6ee38a 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -92,14 +92,14 @@ if ($action == 'add_action') exit; } - $fulldayevent=$_POST["fullday"]; + $fulldayevent=GETPOST('fullday'); // Clean parameters $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); // Check parameters - if (! $datef && $_POST["percentage"] == 100) + if (! $datef && GETPOST('percentage') == 100) { $error++; $action = 'create'; @@ -107,7 +107,7 @@ if ($action == 'add_action') } // Initialisation objet cactioncomm - if (! $_POST["actioncode"]) + if (! GETPOST('actioncode')) { $error++; $action = 'create'; @@ -115,14 +115,14 @@ if ($action == 'add_action') } else { - $result=$cactioncomm->fetch($_POST["actioncode"]); + $result=$cactioncomm->fetch(GETPOST('actioncode')); } // Initialisation objet actioncomm $actioncomm->type_id = $cactioncomm->id; $actioncomm->type_code = $cactioncomm->code; $actioncomm->priority = isset($_POST["priority"])?$_POST["priority"]:0; - $actioncomm->fulldayevent = $_POST["fullday"]?1:0; + $actioncomm->fulldayevent = (! empty($fulldayevent)?1:0); $actioncomm->location = isset($_POST["location"])?$_POST["location"]:''; $actioncomm->label = trim($_POST["label"]); if (! $_POST["label"]) @@ -144,7 +144,7 @@ if ($action == 'add_action') $actioncomm->datep = $datep; $actioncomm->datef = $datef; $actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0; - $actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60; + $actioncomm->duree=((GETPOST('dureehour') * 60) + GETPOST('dureemin')) * 60; $usertodo=new User($db); if ($_POST["affectedto"] > 0) @@ -169,8 +169,9 @@ if ($action == 'add_action') } // Special for module webcal and phenix - if ($_POST["add_webcal"] == 'on' && $conf->webcalendar->enabled) $actioncomm->use_webcal=1; - if ($_POST["add_phenix"] == 'on' && $conf->phenix->enabled) $actioncomm->use_phenix=1; + // FIXME external modules + if (! empty($conf->webcalendar->enabled) && GETPOST('add_webcal') == 'on') $actioncomm->use_webcal=1; + if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1; // Check parameters if ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || $datef == '')) @@ -179,14 +180,14 @@ if ($action == 'add_action') $action = 'create'; $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'
'; } - if ($datea && $_POST["percentage"] == 0) + if (! empty($datea) && GETPOST('percentage') == 0) { $error++; $action = 'create'; $mesg='
'.$langs->trans("ErrorStatusCantBeZeroIfStarted").'
'; } - if (! $_POST["apyear"] && ! $_POST["adyear"]) + if (! GETPOST('apyear') && ! GETPOST('adyear')) { $error++; $action = 'create'; @@ -269,23 +270,27 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') */ if ($action == 'update') { - if (! $_POST["cancel"]) + if (empty($cancel)) { - $fulldayevent=$_POST["fullday"]; + $fulldayevent=GETPOST('fullday'); + $aphour=GETPOST('aphour'); + $apmin=GETPOST('apmin'); + $p2hour=GETPOST('p2hour'); + $p2min=GETPOST('p2min'); // Clean parameters - if ($_POST["aphour"] == -1) $_POST["aphour"]='0'; - if ($_POST["apmin"] == -1) $_POST["apmin"]='0'; - if ($_POST["p2hour"] == -1) $_POST["p2hour"]='0'; - if ($_POST["p2min"] == -1) $_POST["p2min"]='0'; + if ($aphour == -1) $aphour='0'; + if ($apmin == -1) $apmin='0'; + if ($p2hour == -1) $p2hour='0'; + if ($p2min == -1) $p2min='0'; //if ($_POST["adhour"] == -1) $_POST["adhour"]='0'; //if ($_POST["admin"] == -1) $_POST["admin"]='0'; $actioncomm = new Actioncomm($db); $actioncomm->fetch($id); - $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); - $datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); + $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); + $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); $actioncomm->label = $_POST["label"]; $actioncomm->datep = $datep;