Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-08-11 18:31:27 +02:00
commit e4eafcc52e
6 changed files with 68 additions and 14 deletions

View file

@ -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)

View file

@ -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 '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Date for payment
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
// Upload file
if (!empty($object->date_trans)) {
$muser = new User($db);
$muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
// Date upload
print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('TransData');
print '</td>';
if ($action != 'editdate_trans') {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_trans&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetTransDate'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editdate_trans') {
print '<form name="setdate_trans" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setdate_trans">';
print $form->selectDate($object->date_trans ? $object->date_trans : -1, 'date_trans', 0, '', "setdate_trans");
print '<input type="submit" class="button button-edit smallpaddingimp valign middle" value="'.$langs->trans('Modify').'">';
print '</form>';
} else {
print $object->date_trans ? dol_print_date($object->date_trans, 'day') : '';
print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td>';
}
print '</td>';
print '</tr>';
// Method upload
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
}
// Date real payment
if (!empty($object->date_credit)) {
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($object->date_credit, 'day');

View file

@ -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);

View file

@ -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;

View file

@ -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]);

View file

@ -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