Skip to content
Snippets Groups Projects
Commit d6301233 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Suppression fonction print_heure_select qui faisait double emploi avec select_date

parent 7a051a2b
No related branches found
No related tags found
No related merge requests found
......@@ -93,14 +93,14 @@ if ($_POST["action"] == 'add_action')
}
}
}
$actioncomm->date_p = @mktime($_POST["heurephour"],
$_POST["heurepmin"],
$actioncomm->date_p = @mktime($_POST["aphour"],
$_POST["apmin"],
0,
$_POST["apmonth"],
$_POST["apday"],
$_POST["apyear"]);
$actioncomm->date_a = @mktime($_POST["heuredhour"],
$_POST["heuredmin"],
$actioncomm->date_a = @mktime($_POST["adhour"],
$_POST["admin"],
0,
$_POST["admonth"],
$_POST["adday"],
......@@ -183,20 +183,29 @@ if ($_POST["action"] == 'update')
{
if (! $_POST["cancel"])
{
if ($_POST["aphour"] == -1) $_POST["aphour"]='0';
if ($_POST["apmin"] == -1) $_POST["apmin"]='0';
if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
if ($_POST["admin"] == -1) $_POST["admin"]='0';
$action = new Actioncomm($db);
$action->fetch($_POST["id"]);
$action->date_p = @mktime($_POST["heurephour"],
$_POST["heurepmin"],
$action->date_p = @mktime($_POST["aphour"],
$_POST["apmin"],
0,
$_POST["apmonth"],
$_POST["apday"],
$_POST["apyear"]);
$action->date_a = @mktime($_POST["heuredhour"],
$_POST["heuredmin"],
$action->date_a = @mktime($_POST["adhour"],
$_POST["admin"],
0,
$_POST["admonth"],
$_POST["adday"],
$_POST["adyear"]);
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n";
//print $action->datep;
$action->label = $_POST["label"];
$action->percent = $_POST["percent"];
$action->contact->id = $_POST["contactid"];
......@@ -301,15 +310,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{
$html->select_date(-1,'ap','','','',"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
$html->select_date(-1,'ap',1,1,1,"action");
}
else
{
$html->select_date(-1,'ap','','','',"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
$html->select_date(-1,'ap',1,1,1,"action");
}
print '</td></tr>';
......@@ -317,21 +322,17 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{
$html->select_date(-1,'ad','','','',"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
$html->select_date(-1,'ad',1,1,1,"action");
}
else
{
$html->select_date(-1,'ad','','','',"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
$html->select_date(-1,'ad',1,1,1,"action");
}
print '</td></tr>';
// Duration
print '<tr><td>'.$langs->trans("Duration").'</td><td>';
print_duree_select("duree");
$html->select_duree("duree");
print '</td></tr>';
add_row_for_webcal_link();
......@@ -464,15 +465,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{
$html->select_date(-1,'ap','','','',"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
$html->select_date(-1,'ap',1,1,1,"action");
}
else
{
$html->select_date(-1,'ap','','','',"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
$html->select_date(-1,'ap',1,1,1,"action");
}
print '</td></tr>';
......@@ -480,15 +477,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{
$html->select_date(-1,'ad','','','',"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
$html->select_date(-1,'ad',1,1,1,"action");
}
else
{
$html->select_date(-1,'ad','','','',"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
$html->select_date(-1,'ad',1,1,1,"action");
}
print '</td></tr>';
......@@ -599,16 +592,12 @@ if ($_GET["id"])
// Date planification
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">';
$html->select_date(($act->datep?$act->datep:-1),'ap','','','',"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
$html->select_date(($act->datep?$act->datep:-1),'ap',1,1,1,"action");
print '</td></tr>';
// Date done
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td colspan="3">';
$html->select_date(($act->date?$act->date:-1),'ad','','','',"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
$html->select_date(($act->date?$act->date:-1),'ad',1,1,1,"action");
print '</td></tr>';
......
......@@ -1989,11 +1989,11 @@ class Form
* Les champs sont présélectionnées avec:
* - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM)
* - La date du jour si set_time vaut ''
* - Aucune date (champs vides) si set_time vaut -1 (dans ce cas empty doit valoir 0)
* - Aucune date (champs vides) si set_time vaut -1 (dans ce cas empty doit valoir 1)
* \param set_time Date de pré-sélection
* \param prefix Prefix pour nom champ
* \param h Heure
* \param m Minutes
* \param h 1=Affiche aussi les heures
* \param m 1=Affiche aussi les minutes
* \param empty 0=Champ obligatoire, 1=Permet une saisie vide
* \param form_name Nom du formulaire de provenance. Utilisé pour les dates en popup style andre.
*/
......@@ -2040,7 +2040,7 @@ class Form
/*
* Affiche date en popup
*/
if ($conf->use_javascript && $conf->use_popup_calendar && $h==0 && $m==0)
if ($conf->use_javascript && $conf->use_popup_calendar)
{
//print "e".$set_time." t ".$conf->format_date_short;
if ($set_time > 0)
......@@ -2169,8 +2169,8 @@ class Form
if ($h)
{
print '<select class="flat" name="'.$prefix.'hour">';
for ($hour = 0; $hour < 24 ; $hour++)
if ($empty) print '<option value="-1">&nbsp;</option>';
for ($hour = 0; $hour < 24; $hour++)
{
if (strlen($hour) < 2)
{
......@@ -2178,43 +2178,71 @@ class Form
}
if ($hour == $shour)
{
print "<option value=\"$hour\" selected=\"true\">$hour";
print "<option value=\"$hour\" selected=\"true\">$hour</option>";
}
else
{
print "<option value=\"$hour\">$hour";
print "<option value=\"$hour\">$hour</option>";
}
print "</option>";
}
print "</select>H\n";
if ($m)
print "</select>";
print "H\n";
}
/*
* Affiche min en select
*/
if ($m)
{
print '<select class="flat" name="'.$prefix.'min">';
if ($empty) print '<option value="-1">&nbsp;</option>';
for ($min = 0; $min < 60 ; $min++)
{
print '<select class="flat" name="'.$prefix.'min">';
for ($min = 0; $min < 60 ; $min++)
if (strlen($min) < 2)
{
if (strlen($min) < 2)
{
$min = "0" . $min;
}
if ($min == $smin)
{
print "<option value=\"$min\" selected=\"true\">$min";
}
else
{
print "<option value=\"$min\">$min";
}
print "</option>";
$min = "0" . $min;
}
if ($min == $smin)
{
print "<option value=\"$min\" selected=\"true\">$min</option>";
}
else
{
print "<option value=\"$min\">$min</option>";
}
print "</select>M\n";
}
print "</select>";
print "M\n";
}
}
/**
\brief Fonction servant a afficher une durée dans une liste déroulante
\param prefix prefix
*/
function select_duree($prefix)
{
print '<select class="flat" name="'.$prefix.'hour">';
print "<option value=\"0\">0</option>";
for ($hour = 1 ; $hour < 24 ; $hour++)
{
print "<option value=\"$hour\"";
if ($hour == 1) print " selected=\"true\"";
print ">$hour</option>";
}
print "</select>";
print "H &nbsp;";
print '<select class="flat" name="'.$prefix.'min">';
for ($min = 0 ; $min < 55 ; $min=$min+5)
{
print "<option value=\"$min\">$min</option>";
}
print "</select>";
print "M&nbsp;";
}
/**
\brief Affiche un select à partir d'un tableau
\param htmlname Nom de la zone select
......
......@@ -1686,53 +1686,6 @@ function print_fleche_navigation($page,$file,$options='',$nextpage)
}
/**
\brief Fonction servant a afficher les heures/minutes dans un liste droulante
\param prefix
\param begin (1 par defaut)
\param end (23 par defaut)
*/
function print_heure_select($prefix,$begin=1,$end=23)
{
print '<select class="flat" name="'.$prefix.'hour">';
for ($hour = $begin ; $hour <= $end ; $hour++) {
print "<option value=\"$hour\">$hour";
}
print "</select>&nbsp;H&nbsp;";
print '<select class="flat" name="'.$prefix.'min">';
for ($min = 0 ; $min < 60 ; $min=$min+5) {
if ($min < 10) {
$min = "0" . $min;
}
print "<option value=\"$min\">$min";
}
print "</select>\n";
}
/**
\brief Fonction servant a afficher une dure dans une liste droulante
\param prefix prefix
*/
function print_duree_select($prefix)
{
print '<select class="flat" name="'.$prefix.'hour">';
print "<option value=\"0\">0</option>";
print "<option value=\"1\" selected=\"true\">1</option>";
for ($hour = 2 ; $hour < 13 ; $hour++)
{
print "<option value=\"$hour\">$hour</option>";
}
print "</select>&nbsp;H&nbsp;";
print '<select class="flat" name="'.$prefix.'min">';
for ($min = 0 ; $min < 55 ; $min=$min+5)
{
print "<option value=\"$min\">$min</option>";
}
print "</select>\n";
}
/**
\brief Fonction qui retourne un montant montaire format
\remarks Fonction utilise dans les pdf et les pages html
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment