replace select_date

This commit is contained in:
Frédéric FRANCE 2018-09-09 10:40:00 +02:00
parent c2ad09cc0e
commit 8249756726
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
11 changed files with 78 additions and 53 deletions

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -211,13 +212,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
// Date start subscription
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
$form->select_date($object->dateh,'datesub',1,1,0,'update',1);
print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1);
print '</td>';
print '</tr>';
// Date end subscription
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
$form->select_date($object->datef,'datesubend',0,0,0,'update',1);
print $form->selectDate($object->datef, 'datesubend', 0, 0, 0, 'update', 1);
print '</td>';
print '</tr>';

View File

@ -6,7 +6,8 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -689,9 +690,13 @@ if ($action == 'create')
$datep=($datep?$datep:$object->datep);
if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0);
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend');
else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep, 'ap', 1, 1 ,0, "action", 1, 1, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
} else {
print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
}
print '</td></tr>';
// Date end
@ -702,12 +707,17 @@ if ($action == 'create')
$datef=dol_time_plus_duree($datep, $conf->global->AGENDA_AUTOSET_END_DATE_WITH_DELTA_HOURS, 'h');
}
print '<tr><td><span id="dateend"'.(GETPOST("actioncode") == 'AC_RDV'?' class="fieldrequired"':'').'>'.$langs->trans("DateActionEnd").'</span></td><td>';
if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
else $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
}
print '</td></tr>';
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress
// Dev in progress
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent)
{
// Repeat
@ -1057,30 +1067,38 @@ if ($id > 0)
// Date start
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
if (GETPOST("afaire") == 1) $form->select_date($datep?$datep:$object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart');
else if (GETPOST("afaire") == 2) $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
else $form->select_date($datep?$datep:$object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep?$datep:$object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datep?$datep:$object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
} else {
print $form->selectDate($datep?$datep:$object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart');
}
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
if (GETPOST("afaire") == 1) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
//else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend','ap');
else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef?$datef:$object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
} elseif (GETPOST("afaire") == 2) {
print $form->selectDate($datef?$datef:$object->datef,'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
} else {
print $form->selectDate($datef?$datef:$object->datef,'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend');
}
print '</td></tr>';
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); // Dev in progress
// Dev in progress
$userepeatevent=($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0);
if ($userepeatevent)
{
// Repeat
print '<tr><td>'.$langs->trans("RepeatEvent").'</td><td colspan="3">';
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
$arrayrecurrulefreq=array(
'no'=>$langs->trans("No"),
'MONTHLY'=>$langs->trans("EveryMonth"),
'WEEKLY'=>$langs->trans("EveryWeek"),
//'DAYLY'=>$langs->trans("EveryDay")
);
$arrayrecurrulefreq = array(
'no'=>$langs->trans("No"),
'MONTHLY'=>$langs->trans("EveryMonth"),
'WEEKLY'=>$langs->trans("EveryWeek"),
//'DAYLY'=>$langs->trans("EveryDay"),
);
$selectedrecurrulefreq='no';
$selectedrecurrulebymonthday='';
$selectedrecurrulebyday='';

View File

@ -12,7 +12,7 @@
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
* This program is free software; you can redistribute it and/or modify
@ -5295,11 +5295,11 @@ abstract class CommonObject
$showtime = in_array($type,array('datetime')) ? 1 : 0;
// Do not show current date when field not required (see select_date() method)
// Do not show current date when field not required (see selectDate() method)
if (!$required && $value == '') $value = '-1';
// TODO Must also support $moreparam
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1);
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0);
}
elseif (in_array($type,array('int','integer')))
{

View File

@ -95,7 +95,7 @@ class ExtraFields
* @var string Error code (or message)
*/
public $error='';
var $errno;
@ -982,11 +982,11 @@ class ExtraFields
$showtime = in_array($type,array('datetime')) ? 1 : 0;
// Do not show current date when field not required (see select_date() method)
// Do not show current date when field not required (see selectDate() method)
if (!$required && $value == '') $value = '-1';
// TODO Must also support $moreparam
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1);
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0);
}
elseif (in_array($type,array('int','integer')))
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -1042,7 +1043,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
// Form to add new time
print '<td class="nowrap leftborder" align="center">';
$tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask);
$tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask);
print $tableCell;
print '</td>';
@ -1696,4 +1697,3 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
print '</table></form>';
}
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -235,7 +236,7 @@ if ($action == 'create' || empty($action))
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
$form->select_date($datepayment,'','','','',"add_payment",1,1);
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
print "</td>";
print '</tr>';

View File

@ -8,6 +8,7 @@
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -403,7 +404,7 @@ if (empty($reshook))
if(!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$desc = $productsupplier->desc_supplier;
} else $desc = $productsupplier->description;
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
$type = $productsupplier->type;
@ -1542,7 +1543,7 @@ if ($action=='create')
print '<td>';
$usehourmin=0;
if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin=1;
$form->select_date($datelivraison?$datelivraison:-1,'liv_',$usehourmin,$usehourmin,'',"set");
print $form->selectDate($datelivraison?$datelivraison:-1, 'liv_', $usehourmin, $usehourmin, '', "set");
print '</td></tr>';
// Bank Account
@ -2044,7 +2045,7 @@ elseif (! empty($object->id))
print '<input type="hidden" name="action" value="setdate_livraison">';
$usehourmin=0;
if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin=1;
$form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_',$usehourmin,$usehourmin,'',"setdate_livraison");
print $form->selectDate($object->date_livraison?$object->date_livraison:-1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison");
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
print '</form>';
}
@ -2468,7 +2469,7 @@ elseif (! empty($object->id))
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
$date_com = dol_mktime(GETPOST('rehour','int'), GETPOST('remin','int'), GETPOST('resec','int'), GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
if (empty($date_com)) $date_com=dol_now();
print $form->select_date($date_com,'',1,1,'',"commande",1,1,1);
print $form->selectDate($date_com, '', 1, 1, '', "commande", 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
@ -2524,7 +2525,7 @@ elseif (! empty($object->id))
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
$datepreselected = dol_now();
print $form->select_date($datepreselected,'',1,1,'',"commande",1,1,1);
print $form->selectDate($datepreselected, '', 1, 1, '', "commande", 1, 1);
print "</td></tr>\n";
print "<tr><td class=\"fieldrequired\">".$langs->trans("Delivery")."</td><td>\n";

View File

@ -7,6 +7,7 @@
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -636,11 +637,11 @@ if ($id > 0 || ! empty($ref)) {
print '</td>';
print '<td class="nowraponall">';
$dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year'));
$form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, "");
print $form->selectDate($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, '');
print '</td>';
print '<td class="nowraponall">';
$dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year'));
$form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, "");
print $form->selectDate($dluodatesuffix, 'dluo' . $suffix, '', '', 1, '');
print '</td>';
print '<td colspan="3">&nbsp</td>'; // Supplier ref + Qty ordered + qty already dispatched
} else {

View File

@ -1,11 +1,12 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -681,7 +682,7 @@ if ($resql)
print $langs->trans('DateInvoice');
print '</td>';
print '<td>';
print $form->select_date('', '', '', '', '', '', 1, 1);
print $form->selectDate('', '', '', '', '', '', 1, 1);
print '</td>';
print '</tr>';
print '<tr>';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@ -8,6 +8,7 @@
* Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -332,7 +333,7 @@ if ($action == 'create' && !$error) {
// Date invoice
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
$html->select_date('', '', '', '', '', "add", 1, 1);
print $html->selectDate('', '', '', '', '', "add", 1, 1);
print '</td></tr>';
// Payment term
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
@ -486,8 +487,8 @@ if (($action != 'create' && $action != 'add') && !$error) {
$num = $db->num_rows($resql);
print load_fiche_titre($title);
$i = 0;
$period = $html->select_date($date_start, 'date_start', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
$periodely = $html->select_date($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0, 1) . ' - ' . $html->select_date($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0, 1);
$period = $html->selectDate($date_start, 'date_start', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_end, 'date_end', 0, 0, 1, '', 1, 0);
$periodely = $html->selectDate($date_starty, 'date_start_dely', 0, 0, 1, '', 1, 0) . ' - ' . $html->selectDate($date_endy, 'date_end_dely', 0, 0, 1, '', 1, 0);
if (! empty($socid)) {
// Company

View File

@ -4,6 +4,7 @@
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -580,7 +581,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<td class="maxwidthonsmartphone">';
//$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]);
$newdate='';
print $form->select_date($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0, 1);
print $form->selectDate($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0);
print '</td>';
// Contributor
@ -759,7 +760,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<td class="maxwidthonsmartphone">';
//$newdate=dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]);
$newdate='';
print $form->select_date($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0, 1);
print $form->selectDate($newdate, 'time', ($conf->browser->layout == 'phone'?2:1), 1, 2, "timespent_date", 1, 0);
print '</td>';
// Task
@ -965,9 +966,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
{
if (empty($task_time->task_date_withhour))
{
print $form->select_date(($date2?$date2:$date1),'timeline',3,3,2,"timespent_date",1,0,1);
print $form->selectDate(($date2?$date2:$date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0);
}
else print $form->select_date(($date2?$date2:$date1),'timeline',1,1,2,"timespent_date",1,0,1);
else print $form->selectDate(($date2?$date2:$date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0);
}
else
{