| '.$langs->trans('CreditDate').' | ';
print dol_print_date($object->date_credit, 'day');
diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php
index 28e613ca882..46318dbc191 100644
--- a/htdocs/core/boxes/box_birthdays.php
+++ b/htdocs/core/boxes/box_birthdays.php
@@ -94,12 +94,14 @@ class box_birthdays extends ModeleBoxes
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = ".User::STATUS_ENABLED;
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
+ $sql .= " AND u.birth < '".$this->db->idate(dol_get_first_day($tmparray['year']))."'";
$sql .= ' UNION ';
$sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, date_format(u.dateemployment, '%d') as daya, 'employment' as typea, u.email, u.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = ".User::STATUS_ENABLED;
$sql .= dolSqlDateFilter('u.dateemployment', 0, $tmparray['mon'], 0);
+ $sql .= " AND u.dateemployment < '".$this->db->idate(dol_get_first_day($tmparray['year']))."'";
$sql .= " ORDER BY daya ASC"; // We want to have date of the month sorted by the day without taking into consideration the year
$sql .= $this->db->plimit($max, 0);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index eb9183b5b59..33dcfc4b135 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1945,7 +1945,7 @@ abstract class CommonObject
*/
public function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif')
{
- global $user, $langs, $conf;
+ global $user;
if (empty($table)) {
$table = $this->table_element;
@@ -1964,9 +1964,13 @@ abstract class CommonObject
if ($table == 'product' && $field == 'note_private') {
$field = 'note';
}
+
if (in_array($table, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
$fk_user_field = 'fk_user_mod';
}
+ if (in_array($table, array('prelevement_bons'))) { // TODO Add a field fk_user_modif into llx_prelevement_bons
+ $fk_user_field = '';
+ }
if ($trigkey) {
$oldvalue = null;
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index cb4bd240ea4..ed640f4b9e8 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -239,6 +239,18 @@ $pagetitle = $langs->trans("CronList");
llxHeader('', $pagetitle);
+$TTestNotAllowed = array();
+$sqlTest = 'SELECT rowid, test FROM '.MAIN_DB_PREFIX.'cronjob';
+$resultTest = $db->query($sqlTest);
+if ($resultTest) {
+ while ($objTest = $db->fetch_object($resultTest)) {
+ $veriftest = verifCond($objTest->test);
+ if (!$veriftest) {
+ $TTestNotAllowed[$objTest->rowid] = $objTest->rowid;
+ }
+ }
+}
+
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.tms,";
@@ -273,6 +285,9 @@ $sql .= " t.libname,";
$sql .= " t.test";
$sql .= " FROM ".MAIN_DB_PREFIX."cronjob as t";
$sql .= " WHERE entity IN (0,".$conf->entity.")";
+if (!empty($TTestNotAllowed)) {
+ $sql .= ' AND t.rowid NOT IN ('.$db->sanitize(implode(',', $TTestNotAllowed)).')';
+}
if ($search_status >= 0 && $search_status < 2 && $search_status != '') {
$sql .= " AND t.status = ".(empty($search_status) ? '0' : '1');
}
@@ -299,7 +314,6 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // No
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
-
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
@@ -507,13 +521,6 @@ if ($num > 0) {
break;
}
- if (isset($obj->test)) {
- $veriftest = verifCond($obj->test);
- if (!$veriftest) {
- continue; // Discard line with test = false
- }
- }
-
$reg = array();
if (preg_match('/:(.*)$/', $obj->label, $reg)) {
$langs->load($reg[1]);
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index d1de39c049d..5c58c71f8e1 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -591,12 +591,18 @@ if (empty($reshook)) {
if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();
+ } else {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
}
} elseif ($action == 'classifyclosed' && $permissiontoread) {
$result = $object->setClosed();
if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit();
+ } else {
+ setEventMessages($object->error, $object->errors, 'errors');
+ $action = '';
}
} elseif ($action == 'deleteline' && !empty($line_id) && $permissiontoread) {
// delete a line
|