diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 9fb103aa6c5..b0a7bab2899 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -757,9 +757,8 @@ class FactureRec extends Facture
dol_syslog(get_class($this)."::setNextDate was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
- $date = $this->db->idate($date);
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql.= ' SET date_when = "'.$date.'"';
+ $sql.= ' SET date_when = "'.$this->db->idate($date).'"';
if ($increment_nb_gen_done>0) $sql.= ', nb_gen_done = nb_gen_done + 1';
$sql.= ' WHERE rowid = '.$this->id;
@@ -790,6 +789,8 @@ class FactureRec extends Facture
return -1;
}
+ if (empty($nb)) $nb=0;
+
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET nb_gen_max = '.$nb;
$sql.= ' WHERE rowid = '.$this->id;
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index 47f24fdebe5..42c82a1642d 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -86,7 +86,10 @@ if ($action == 'add')
$reyear=GETPOST('reyear');
$remonth=GETPOST('remonth');
$reday=GETPOST('reday');
+ $rehour=GETPOST('rehour');
+ $remin=GETPOST('remin');
$nb_gen_max=GETPOST('nb_gen_max', 'int');
+ if (empty($nb_gen_max)) $nb_gen_max =0;
if (GETPOST('frequency'))
{
@@ -96,7 +99,7 @@ if ($action == 'add')
$action = "create";
$error++;
}
- if (empty($nb_gen_max))
+ if ($nb_gen_max == '')
{
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->trans("MaxPeriodNumber")), null, 'errors');
$action = "create";
@@ -115,7 +118,7 @@ if ($action == 'add')
$object->nb_gen_max = $nb_gen_max;
$object->auto_validate = GETPOST('auto_validate', 'int');
- $date_next_execution = dol_mktime(12, 0, 0, $remonth, $reday, $reyear);
+ $date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
$object->date_when = $date_next_execution;
if ($object->create($user, $id) > 0)
@@ -171,7 +174,7 @@ elseif ($action == 'setfrequency' && $user->rights->facture->creer)
// Set next date of execution
elseif ($action == 'setdate_when' && $user->rights->facture->creer)
{
- $date = dol_mktime(12, 0, 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
+ $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear'));
if (!empty($date)) $object->setNextDate($date);
}
// Set max period
@@ -238,7 +241,7 @@ if ($action == 'create')
// Note
print '
';
- print '';
+ print '';
print ' | ';
// Author
@@ -262,7 +265,7 @@ if ($action == 'create')
{
$project = new Project($db);
$project->fetch($object->fk_project);
- print $project->title;
+ print $project->getNomUrl(1);
}
print "";
}
@@ -277,12 +280,12 @@ if ($action == 'create')
print "";
- print '
';
+ print '
';
// Autogeneration
$title = $langs->trans("Recurrence");
- print load_fiche_titre($title);
+ print load_fiche_titre($title, '', 'calendar');
print '';
@@ -294,7 +297,7 @@ if ($action == 'create')
// First date of execution for cron
print "| ".$langs->trans('NextDateToExecution')." | ";
$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
- print $form->select_date($date_next_execution, '', 0, 0, '', "add", 1, 1, 1);
+ print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1);
print " |
";
// Number max of generation
@@ -309,7 +312,7 @@ if ($action == 'create')
print "
";
- print '
';
+ print '
';
$title = $langs->trans("ProductsAndServices");
if (empty($conf->service->enabled))
@@ -317,7 +320,7 @@ if ($action == 'create')
else if (empty($conf->product->enabled))
$title = $langs->trans("Services");
- print load_fiche_titre($title);
+ print load_fiche_titre($title, '', '');
/*
* Invoice lines
@@ -716,9 +719,9 @@ else
//{
// Date when
print '| ';
- print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer);
+ print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'dayhour');
print ' | ';
- print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'datepicker');
+ print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'dayhour');
print ' | ';
print '
';
@@ -727,7 +730,7 @@ else
print '| ';
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
print ' | ';
- if ($object->nb_gen_max > 0) print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
+ print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
print ' | ';
print '
';
print '| '.$langs->trans("RestPeriodNumber").' | ';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 17a3601a660..4480fe7dd9a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -122,7 +122,7 @@ class Form
* @param string $value Value to show/edit
* @param object $object Object
* @param boolean $perm Permission to allow button to edit parameter
- * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...)
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'day' or 'datepicker', 'dayhour' or 'datepickerhour', 'ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols', 'select:xxx'...)
* @param string $editvalue When in edit mode, use this value as $value instead of value (for example, you can provide here a formated price instead of value). Use '' to use same than $value
* @param object $extObject External object
* @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage')