diff --git a/README.md b/README.md index e4b464d77b4..522483d1646 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # DOLIBARR ERP & CRM ![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg) -![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg?style=flat-square)](https://php.net/) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/) [![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 9e5f79a0c01..5031a78b4de 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -37,10 +37,12 @@ $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawal // Get supervariables $action = GETPOST('action', 'aZ09'); + $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $type = GETPOST('type', 'aZ09'); +$date_trans = dol_mktime(GETPOST('date_transhour', 'int'), GETPOST('date_transmin', 'int'), GETPOST('date_transsec', 'int'), GETPOST('date_transmonth', 'int'), GETPOST('date_transday', 'int'), GETPOST('date_transyear', 'int')); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -105,6 +107,14 @@ if (empty($reshook)) { $object->update($user); } + // date of upload + if ($action == 'setdate_trans' && $permissiontoadd) { + $result = $object->setValueFrom('date_trans', $date_trans, '', null, 'date'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + if ($action == 'infotrans' && $permissiontosend) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -193,21 +203,47 @@ if ($id > 0 || $ref) { print '
'; print ''; + // Date for payment print ''; print ''; + // Upload file if (!empty($object->date_trans)) { $muser = new User($db); $muser->fetch($object->user_trans); - print ''; + // Date upload + print ''; + } + print ''; + print ''; + + // Method upload print ''; } + + // Date real payment if (!empty($object->date_credit)) { print '
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'.$langs->trans("Amount").''.price($object->amount).'
'.$langs->trans("TransData").''; - print dol_print_date($object->date_trans, 'day'); - print '   '.$langs->trans("By").' '.$muser->getNomUrl(-1).'
'; + print ''; + if ($action != 'editdate_trans') { + print ''; + } + print '
'; + print $langs->trans('TransData'); + print 'id.'">'.img_edit($langs->trans('SetTransDate'), 1).'
'; + print '
'; + if ($action == 'editdate_trans') { + print '
'; + print ''; + print ''; + print $form->selectDate($object->date_trans ? $object->date_trans : -1, 'date_trans', 0, '', "setdate_trans"); + print ''; + print '
'; + } else { + print $object->date_trans ? dol_print_date($object->date_trans, 'day') : ''; + print '   '.$langs->trans("By").' '.$muser->getNomUrl(-1).'
'.$langs->trans("TransMetod").''; print $object->methodes_trans[$object->method_trans]; print '
'.$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