From 82497567264152e04175dc33361cbe7d3516af77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 9 Sep 2018 10:40:00 +0200 Subject: [PATCH] replace select_date --- htdocs/adherents/subscription/card.php | 7 +-- htdocs/comm/action/card.php | 62 +++++++++++++++-------- htdocs/core/class/commonobject.class.php | 6 +-- htdocs/core/class/extrafields.class.php | 6 +-- htdocs/core/lib/project.lib.php | 4 +- htdocs/expensereport/payment/payment.php | 7 +-- htdocs/fourn/commande/card.php | 11 ++-- htdocs/fourn/commande/dispatch.php | 5 +- htdocs/fourn/commande/list.php | 5 +- htdocs/fourn/commande/orderstoinvoice.php | 9 ++-- htdocs/projet/tasks/time.php | 9 ++-- 11 files changed, 78 insertions(+), 53 deletions(-) diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 34b58c5b04d..9f5c15ad951 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2007-2012 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * 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 ''.$langs->trans("DateSubscription").''; - $form->select_date($object->dateh,'datesub',1,1,0,'update',1); + print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1); print ''; print ''; // Date end subscription print ''.$langs->trans("DateEndSubscription").''; - $form->select_date($object->datef,'datesubend',0,0,0,'update',1); + print $form->selectDate($object->datef, 'datesubend', 0, 0, 0, 'update', 1); print ''; print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index dfdc920453d..ad7c8f9f0ff 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -6,7 +6,8 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * 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 ''.$langs->trans("DateActionStart").''; - 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 ''; // 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 ''.$langs->trans("DateActionEnd").''; - 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 ''; - $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 ''.$langs->trans("DateActionStart").''; - 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 ''; // Date end print ''.$langs->trans("DateActionEnd").''; - 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 ''; - $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 ''.$langs->trans("RepeatEvent").''; print ''; - $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=''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d9053cce731..0369b0fbdfc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2017 ATM Consulting * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2018 Frederic France + * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Josep Lluís Amador * * 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'))) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d7b16293a11..c1e4bba8a12 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -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'))) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index db1aff3d444..a805bbfaad2 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * 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 ''; - $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 ''; @@ -1696,4 +1697,3 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks= print ''; } } - diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index dc78b933055..5136dff3cce 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -1,6 +1,7 @@ - * Copyright (C) 2015 Laurent Destailleur +/* Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * 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 ''.$langs->trans("Date").''; $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 ""; print ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0ed6f7fed14..471a645950d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -8,6 +8,7 @@ * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ion Agorria + * Copyright (C) 2018 Frédéric France * * 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 ''; $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 ''; // Bank Account @@ -2044,7 +2045,7 @@ elseif (! empty($object->id)) print ''; $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 ''; print ''; } @@ -2468,7 +2469,7 @@ elseif (! empty($object->id)) print ''.$langs->trans("OrderDate").''; $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 ''; print ''.$langs->trans("OrderMode").''; @@ -2524,7 +2525,7 @@ elseif (! empty($object->id)) //print ''.$langs->trans("Receive").''; print ''.$langs->trans("DeliveryDate").''; $datepreselected = dol_now(); - print $form->select_date($datepreselected,'',1,1,'',"commande",1,1,1); + print $form->selectDate($datepreselected, '', 1, 1, '', "commande", 1, 1); print "\n"; print "".$langs->trans("Delivery")."\n"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index ea14b9aca90..6aa9b5ca127 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -7,6 +7,7 @@ * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * 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 ''; print ''; $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 ''; print ''; $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 ''; print ' '; // Supplier ref + Qty ordered + qty already dispatched } else { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4123e73d522..823e7261fc8 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1,11 +1,12 @@ +/* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * 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 ''; print ''; - print $form->select_date('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', '', '', '', '', 1, 1); print ''; print ''; print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index ee6cc6c6af8..1409fb5ea78 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin @@ -8,6 +8,7 @@ * Copyright (C) 2012-2017 Juanjo Menent * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Frédéric France * * 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 '' . $langs->trans('Date') . ''; - $html->select_date('', '', '', '', '', "add", 1, 1); + print $html->selectDate('', '', '', '', '', "add", 1, 1); print ''; // Payment term print '' . $langs->trans('PaymentConditionsShort') . ''; @@ -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 diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 18adfc47bed..e432fcdf7fd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -4,6 +4,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Frédéric France * * 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 ''; //$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 ''; // Contributor @@ -759,7 +760,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; //$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 ''; // 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 {