2
0
forked from Wavyzz/dolibarr

Qual: Suppression fonction print_heure_select qui faisait double emploi avec select_date

This commit is contained in:
Laurent Destailleur
2006-09-10 13:46:25 +00:00
parent 7a051a2b28
commit d6301233da
3 changed files with 86 additions and 116 deletions

View File

@@ -93,14 +93,14 @@ if ($_POST["action"] == 'add_action')
} }
} }
} }
$actioncomm->date_p = @mktime($_POST["heurephour"], $actioncomm->date_p = @mktime($_POST["aphour"],
$_POST["heurepmin"], $_POST["apmin"],
0, 0,
$_POST["apmonth"], $_POST["apmonth"],
$_POST["apday"], $_POST["apday"],
$_POST["apyear"]); $_POST["apyear"]);
$actioncomm->date_a = @mktime($_POST["heuredhour"], $actioncomm->date_a = @mktime($_POST["adhour"],
$_POST["heuredmin"], $_POST["admin"],
0, 0,
$_POST["admonth"], $_POST["admonth"],
$_POST["adday"], $_POST["adday"],
@@ -183,20 +183,29 @@ if ($_POST["action"] == 'update')
{ {
if (! $_POST["cancel"]) 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 = new Actioncomm($db);
$action->fetch($_POST["id"]); $action->fetch($_POST["id"]);
$action->date_p = @mktime($_POST["heurephour"],
$_POST["heurepmin"],
$action->date_p = @mktime($_POST["aphour"],
$_POST["apmin"],
0, 0,
$_POST["apmonth"], $_POST["apmonth"],
$_POST["apday"], $_POST["apday"],
$_POST["apyear"]); $_POST["apyear"]);
$action->date_a = @mktime($_POST["heuredhour"], $action->date_a = @mktime($_POST["adhour"],
$_POST["heuredmin"], $_POST["admin"],
0, 0,
$_POST["admonth"], $_POST["admonth"],
$_POST["adday"], $_POST["adday"],
$_POST["adyear"]); $_POST["adyear"]);
//print $_POST["apmonth"].",".$_POST["apday"].",".$_POST["apyear"].",".$_POST["aphour"].",".$_POST["apmin"]."<br>\n";
//print $action->datep;
$action->label = $_POST["label"]; $action->label = $_POST["label"];
$action->percent = $_POST["percent"]; $action->percent = $_POST["percent"];
$action->contact->id = $_POST["contactid"]; $action->contact->id = $_POST["contactid"];
@@ -301,15 +310,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{ {
$html->select_date(-1,'ap','','','',"action"); $html->select_date(-1,'ap',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
} }
else else
{ {
$html->select_date(-1,'ap','','','',"action"); $html->select_date(-1,'ap',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
} }
print '</td></tr>'; print '</td></tr>';
@@ -317,21 +322,17 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{ {
$html->select_date(-1,'ad','','','',"action"); $html->select_date(-1,'ad',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
} }
else else
{ {
$html->select_date(-1,'ad','','','',"action"); $html->select_date(-1,'ad',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
} }
print '</td></tr>'; print '</td></tr>';
// Duration // Duration
print '<tr><td>'.$langs->trans("Duration").'</td><td>'; print '<tr><td>'.$langs->trans("Duration").'</td><td>';
print_duree_select("duree"); $html->select_duree("duree");
print '</td></tr>'; print '</td></tr>';
add_row_for_webcal_link(); add_row_for_webcal_link();
@@ -464,15 +465,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{ {
$html->select_date(-1,'ap','','','',"action"); $html->select_date(-1,'ap',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
} }
else else
{ {
$html->select_date(-1,'ap','','','',"action"); $html->select_date(-1,'ap',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
} }
print '</td></tr>'; print '</td></tr>';
@@ -480,15 +477,11 @@ if ($_GET["action"] == 'create')
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>'; print '<tr><td>'.$langs->trans("DateActionDone").'</td><td>';
if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2) if ($_GET["afaire"] == 1 || $_GET["afaire"] == 2)
{ {
$html->select_date(-1,'ad','','','',"action"); $html->select_date(-1,'ad',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
} }
else else
{ {
$html->select_date(-1,'ad','','','',"action"); $html->select_date(-1,'ad',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
} }
print '</td></tr>'; print '</td></tr>';
@@ -599,16 +592,12 @@ if ($_GET["id"])
// Date planification // Date planification
print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateActionPlanned").'</td><td colspan="3">';
$html->select_date(($act->datep?$act->datep:-1),'ap','','','',"action"); $html->select_date(($act->datep?$act->datep:-1),'ap',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heurep",8,20);
print '</td></tr>'; print '</td></tr>';
// Date done // Date done
print '<tr><td>'.$langs->trans("DateActionDone").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateActionDone").'</td><td colspan="3">';
$html->select_date(($act->date?$act->date:-1),'ad','','','',"action"); $html->select_date(($act->date?$act->date:-1),'ad',1,1,1,"action");
print ' &nbsp; ';
print_heure_select("heured",8,20);
print '</td></tr>'; print '</td></tr>';

View File

@@ -1989,11 +1989,11 @@ class Form
* Les champs sont pr<70>s<EFBFBD>lectionn<6E>es avec: * Les champs sont pr<70>s<EFBFBD>lectionn<6E>es avec:
* - La date set_time (timestamps ou date au format YYYY-MM-DD ou YYYY-MM-DD HH:MM) * - 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 '' * - 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<70>-s<>lection * \param set_time Date de pr<70>-s<>lection
* \param prefix Prefix pour nom champ * \param prefix Prefix pour nom champ
* \param h Heure * \param h 1=Affiche aussi les heures
* \param m Minutes * \param m 1=Affiche aussi les minutes
* \param empty 0=Champ obligatoire, 1=Permet une saisie vide * \param empty 0=Champ obligatoire, 1=Permet une saisie vide
* \param form_name Nom du formulaire de provenance. Utilis<69> pour les dates en popup style andre. * \param form_name Nom du formulaire de provenance. Utilis<69> pour les dates en popup style andre.
*/ */
@@ -2040,7 +2040,7 @@ class Form
/* /*
* Affiche date en popup * 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; //print "e".$set_time." t ".$conf->format_date_short;
if ($set_time > 0) if ($set_time > 0)
@@ -2169,8 +2169,8 @@ class Form
if ($h) if ($h)
{ {
print '<select class="flat" name="'.$prefix.'hour">'; print '<select class="flat" name="'.$prefix.'hour">';
if ($empty) print '<option value="-1">&nbsp;</option>';
for ($hour = 0; $hour < 24 ; $hour++) for ($hour = 0; $hour < 24; $hour++)
{ {
if (strlen($hour) < 2) if (strlen($hour) < 2)
{ {
@@ -2178,20 +2178,24 @@ class Form
} }
if ($hour == $shour) if ($hour == $shour)
{ {
print "<option value=\"$hour\" selected=\"true\">$hour"; print "<option value=\"$hour\" selected=\"true\">$hour</option>";
} }
else else
{ {
print "<option value=\"$hour\">$hour"; print "<option value=\"$hour\">$hour</option>";
} }
print "</option>";
} }
print "</select>H\n"; print "</select>";
print "H\n";
}
/*
* Affiche min en select
*/
if ($m) if ($m)
{ {
print '<select class="flat" name="'.$prefix.'min">'; print '<select class="flat" name="'.$prefix.'min">';
if ($empty) print '<option value="-1">&nbsp;</option>';
for ($min = 0; $min < 60 ; $min++) for ($min = 0; $min < 60 ; $min++)
{ {
if (strlen($min) < 2) if (strlen($min) < 2)
@@ -2200,20 +2204,44 @@ class Form
} }
if ($min == $smin) if ($min == $smin)
{ {
print "<option value=\"$min\" selected=\"true\">$min"; print "<option value=\"$min\" selected=\"true\">$min</option>";
} }
else else
{ {
print "<option value=\"$min\">$min"; print "<option value=\"$min\">$min</option>";
} }
print "</option>";
} }
print "</select>M\n"; print "</select>";
print "M\n";
} }
} }
/**
\brief Fonction servant a afficher une dur<75>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 <20> partir d'un tableau \brief Affiche un select <20> partir d'un tableau

View File

@@ -1686,53 +1686,6 @@ function print_fleche_navigation($page,$file,$options='',$nextpage)
} }
/**
\brief Fonction servant a afficher les heures/minutes dans un liste d<>roulante
\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 dur<75>e dans une liste d<>roulante
\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 mon<6F>taire format<61> \brief Fonction qui retourne un montant mon<6F>taire format<61>
\remarks Fonction utilis<69>e dans les pdf et les pages html \remarks Fonction utilis<69>e dans les pdf et les pages html