Skip to content

Commit

Permalink
replace select_date
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic34 committed Sep 9, 2018
1 parent 80880d8 commit 4a7ea33
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 59 deletions.
4 changes: 2 additions & 2 deletions htdocs/adherents/card.php
Expand Up @@ -980,7 +980,7 @@ function initfieldrequired()

// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print $form->selectDate(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";

// Public profil
Expand Down Expand Up @@ -1218,7 +1218,7 @@ function initfieldrequired()

// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print $form->selectDate(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n";

// Public profil
Expand Down
6 changes: 3 additions & 3 deletions htdocs/adherents/subscription.php
Expand Up @@ -895,7 +895,7 @@
$datefrom=dol_time_plus_duree($object->datefin,1,'d');
}
}
print $form->select_date($datefrom,'','','','',"subscription",1,1,1);
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
print "</td></tr>";

// Date end subscription
Expand All @@ -908,7 +908,7 @@
$dateto=-1; // By default, no date is suggested
}
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
print $form->select_date($dateto,'end','','','',"subscription",1,0,1);
print $form->selectDate($dateto, 'end', '', '', '', "subscription", 1, 0);
print "</td></tr>";

if ($adht->subscription)
Expand Down Expand Up @@ -1009,7 +1009,7 @@

// Date of payment
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'subscription',1,1,1);
print $form->selectDate(isset($paymentdate)?$paymentdate:-1, 'payment', 0, 0, 1, 'subscription', 1, 1);
print "</td></tr>\n";

print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');
Expand Down
12 changes: 6 additions & 6 deletions htdocs/expensereport/card.php
Expand Up @@ -1335,15 +1335,15 @@
print '<tr>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("DateStart").'</td>';
print '<td>';
$form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1);
print $form->selectDate($date_start?$date_start:-1, 'date_debut', 0, 0, 0, '', 1, 1);
print '</td>';
print '</tr>';

// Date end
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td>';
print '<td>';
$form->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1);
print $form->selectDate($date_end?$date_end:-1, 'date_fin', 0, 0, 0, '', 1, 1);
print '</td>';
print '</tr>';

Expand Down Expand Up @@ -1500,13 +1500,13 @@
print '<tr>';
print '<td>'.$langs->trans("DateStart").'</td>';
print '<td>';
$form->select_date($object->date_debut,'date_debut');
print $form->selectDate($object->date_debut, 'date_debut');
print '</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("DateEnd").'</td>';
print '<td>';
$form->select_date($object->date_fin,'date_fin');
print $form->selectDate($object->date_fin, 'date_fin');
print '</td>';
print '</tr>';

Expand Down Expand Up @@ -2078,7 +2078,7 @@

// Select date
print '<td class="center">';
$form->select_date($line->date,'date');
print $form->selectDate($line->date,'date');
print '</td>';

// Select project
Expand Down Expand Up @@ -2161,7 +2161,7 @@

// Select date
print '<td align="center">';
$form->select_date($date?$date:-1,'date');
print $form->selectDate($date?$date:-1, 'date');
print '</td>';

// Select project
Expand Down
6 changes: 3 additions & 3 deletions htdocs/expensereport/export_csv.php
Expand Up @@ -114,15 +114,15 @@
{
if($_POST['action'] == 'export')
{
$select_date = $_POST['annee'].'-'.$_POST['mois'];
$dateselected = $_POST['annee'].'-'.$_POST['mois'];

//var_dump($conf->expensereport->dir_output.'/export/');
if (!file_exists($conf->expensereport->dir_output.'/export/'))
{
dol_mkdir($conf->expensereport->dir_output.'/export/');
}

$dir = $conf->expensereport->dir_output.'/export/expensereport-'.$select_date.'.csv';
$dir = $conf->expensereport->dir_output.'/export/expensereport-'.$dateselected.'.csv';
$outputlangs = $langs;
$outputlangs->charset_output = 'UTF-8';

Expand Down Expand Up @@ -183,7 +183,7 @@
fwrite($open,$ligne);
fclose($open);

print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=expensereport&file=export%2Fexpensereport-'.$select_date.'.csv" target="_blank">Télécharger le fichier expensereport-'.$select_date.'.csv</a>';
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart=expensereport&file=export%2Fexpensereport-'.$dateselected.'.csv" target="_blank">Télécharger le fichier expensereport-'.$dateselected.'.csv</a>';

} else {

Expand Down
2 changes: 1 addition & 1 deletion htdocs/fichinter/card-rec.php
Expand Up @@ -357,7 +357,7 @@
$date_next_execution = (GETPOST('remonth') ? dol_mktime(
12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')
) : -1);
print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1);
print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1);
print "</td></tr>";

// Number max of generation
Expand Down
20 changes: 10 additions & 10 deletions htdocs/holiday/card.php
Expand Up @@ -909,10 +909,10 @@ function valider()
print '<td>';
// Si la demande ne vient pas de l'agenda
if (! GETPOST('date_debut_')) {
$form->select_date(-1, 'date_debut_', 0, 0, 0, '', 1, 1);
print $form->selectDate(-1, 'date_debut_', 0, 0, 0, '', 1, 1);
} else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('date_debut_month','int'), GETPOST('date_debut_day','int'), GETPOST('date_debut_year','int'));
$form->select_date($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1);
print $form->selectDate($tmpdate, 'date_debut_', 0, 0, 0, '', 1, 1);
}
print ' &nbsp; &nbsp; ';
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday','alpha')?GETPOST('starthalfday','alpha'):'morning'));
Expand All @@ -928,10 +928,10 @@ function valider()
print '<td>';
// Si la demande ne vient pas de l'agenda
if (! GETPOST('date_fin_')) {
$form->select_date(-1,'date_fin_', 0, 0, 0, '', 1, 1);
print $form->selectDate(-1, 'date_fin_', 0, 0, 0, '', 1, 1);
} else {
$tmpdate = dol_mktime(0, 0, 0, GETPOST('date_fin_month','int'), GETPOST('date_fin_day','int'), GETPOST('date_fin_year','int'));
$form->select_date($tmpdate,'date_fin_', 0, 0, 0, '', 1, 1);
print $form->selectDate($tmpdate, 'date_fin_', 0, 0, 0, '', 1, 1);
}
print ' &nbsp; &nbsp; ';
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday','alpha')?GETPOST('endhalfday','alpha'):'afternoon'));
Expand Down Expand Up @@ -1104,9 +1104,9 @@ function valider()
print '<tr>';
print '<td class="nowrap">'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>';
$form->select_date($object->date_debut,'date_debut_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday));
print $form->selectDate($object->date_debut, 'date_debut_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday));
print '</td>';
print '</tr>';
}
Expand All @@ -1126,9 +1126,9 @@ function valider()
print '<tr>';
print '<td class="nowrap">'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
print '<td>';
$form->select_date($object->date_fin,'date_fin_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday));
print $form->selectDate($object->date_fin, 'date_fin_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday));
print '</td>';
print '</tr>';
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/holiday/document.php
Expand Up @@ -152,7 +152,7 @@
print '<tr>';
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>';
$form->select_date($object->date_debut,'date_debut_');
print $form->selectDate($object->date_debut, 'date_debut_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('starthalfday', $listhalfday, (GETPOST('starthalfday')?GETPOST('starthalfday'):$starthalfday));
print '</td>';
Expand All @@ -174,9 +174,9 @@
print '<tr>';
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
print '<td>';
$form->select_date($object->date_fin,'date_fin_');
print $form->selectDate($object->date_fin, 'date_fin_');
print ' &nbsp; &nbsp; ';
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday));
print $form->selectarray('endhalfday', $listhalfday, (GETPOST('endhalfday')?GETPOST('endhalfday'):$endhalfday));
print '</td>';
print '</tr>';
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/livraison/card.php
Expand Up @@ -506,7 +506,7 @@
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setdate_livraison">';
$form->select_date($object->date_delivery?$object->date_delivery:-1, 'liv_', 1, 1, '', "setdate_livraison", 1, 1);
print $form->selectDate($object->date_delivery?$object->date_delivery:-1, 'liv_', 1, 1, '', "setdate_livraison", 1, 1);
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
Expand Down
5 changes: 2 additions & 3 deletions htdocs/margin/agentMargins.php
Expand Up @@ -110,11 +110,11 @@
// Start date
print '<td>'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')</td>';
print '<td>';
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td>'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')</td>';
print '<td>';
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td style="text-align: center;">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Refresh')).'" />';
Expand Down Expand Up @@ -271,4 +271,3 @@
// End of page
llxFooter();
$db->close();

4 changes: 2 additions & 2 deletions htdocs/margin/checkMargins.php
Expand Up @@ -165,11 +165,11 @@

print '<tr><td class="titlefield">' . $langs->trans('DateStart') . ' (' . $langs->trans("DateValidation") . ')</td>';
print '<td>';
$form->select_date($startdate, 'startdate', '', '', 1, "sel", 1, 1);
print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td>' . $langs->trans('DateEnd') . ' (' . $langs->trans("DateValidation") . ')</td>';
print '<td>';
$form->select_date($enddate, 'enddate', '', '', 1, "sel", 1, 1);
print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td style="text-align: center;">';
print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Refresh')) . '" name="button_search" />';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/margin/customerMargins.php
Expand Up @@ -159,11 +159,11 @@
// Start date
print '<td>'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')</td>';
print '<td>';
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td>'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')</td>';
print '<td>';
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td style="text-align: center;">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Refresh')).'" />';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/margin/productMargins.php
Expand Up @@ -134,11 +134,11 @@
print '<tr>';
print '<td class="titlefield">'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')</td>';
print '<td>';
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
print $form->selectDate($startdate, 'startdate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td>'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')</td>';
print '<td>';
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
print $form->selectDate($enddate, 'enddate', '', '', 1, "sel", 1, 1);
print '</td>';
print '<td style="text-align: center;">';
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Refresh')).'" />';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/element.php
Expand Up @@ -529,10 +529,10 @@
print '<input type="hidden" name="action" value="view">';
print '<table class="center"><tr>';
print '<td>'.$langs->trans("From").' ';
print $form->select_date($dates,'dates',0,0,1,'',1,0,1);
print $form->selectDate($dates, 'dates', 0, 0, 1, '', 1, 0);
print '</td>';
print '<td>'.$langs->trans("to").' ';
print $form->select_date($datee,'datee',0,0,1,'',1,0,1);
print $form->selectDate($datee, 'datee', 0, 0, 1, '', 1, 0);
print '</td>';
print '<td>';
print '<input type="submit" name="refresh" value="'.$langs->trans("Refresh").'" class="button">';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/projet/tasks.php
Expand Up @@ -480,12 +480,12 @@

// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->select_date(($date_start?$date_start:''),'dateo',1,1,0,'',1,1,1);
print $form->selectDate(($date_start?$date_start:''), 'dateo', 1, 1, 0, '', 1, 1);
print '</td></tr>';

// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date(($date_end?$date_end:-1),'datee',-1,1,0,'',1,1,1);
print $form->selectDate(($date_end?$date_end:-1),'datee', -1, 1, 0, '', 1, 1);
print '</td></tr>';

// Planned workload
Expand Down
6 changes: 3 additions & 3 deletions htdocs/public/test/test_arrays.php
Expand Up @@ -174,9 +174,9 @@
if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
if ($type) $nav.='<input type="hidden" name="type" value="'.$type.'">';
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
$nav.='</form>';
$nav.= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav.= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
$nav.= '</form>';

$limit=10;
print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit);
Expand Down
14 changes: 7 additions & 7 deletions htdocs/public/test/test_forms.php
Expand Up @@ -27,29 +27,29 @@
<?php
$form=new Form($db);

// Test1: form->select_date using tzuser date
// Test1: form->selectDate using tzuser date
print "Test 1a: We must have here current date and hour for user (must match hour on browser). Note: Check your are logged so user TZ and DST are known.";
$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60;
$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60;
print " (dol_tz=".$offsettz." dol_dst=".$dol_dst.")<br>\n";
$form->select_date(dol_now(), 'test1a', 1, 1, 0);
print $form->selectDate(dol_now(), 'test1a', 1, 1, 0);

print '<br><br>'."\n";

print "Test 1b: We must have here current date with hours to 00:00.<br>";
$form->select_date('', 'test1b', 1, 1, 0);
print $form->selectDate('', 'test1b', 1, 1, 0);

print '<br><br>'."\n";

// Test2: form->select_date using tzuser date
// Test2: form->selectDate using tzuser date
print "Test 2: We must have here 1970-01-01 00:00:00 selected (fields can be empty)<br>\n";
$form->select_date(dol_get_first_day(1970,1,false), 'test2', 1, 1, 1);
print $form->selectDate(dol_get_first_day(1970,1,false), 'test2', 1, 1, 1);

print '<br><br>'."\n";

// Test3: form->select_date for 1970-01-01 00:00:00
// Test3: form->selectDate for 1970-01-01 00:00:00
print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)<br>\n";
$form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0);
print $form->selectDate(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0);

print '<br><br>'."\n";

Expand Down

0 comments on commit 4a7ea33

Please sign in to comment.