Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop#5
This commit is contained in:
commit
83ea868c9a
@ -167,15 +167,16 @@ class Conf
|
||||
* Load setup values into conf object (read llx_const) for a specified entity
|
||||
* Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $entity Entity to get
|
||||
* @return int < 0 if KO, >= 0 if OK
|
||||
*/
|
||||
public function setEntityValues($entity)
|
||||
public function setEntityValues($db, $entity)
|
||||
{
|
||||
if ($this->entity != $entity) {
|
||||
// If we ask to reload setup for a new entity
|
||||
$this->entity = $entity;
|
||||
return $this->setValues($this->db);
|
||||
return $this->setValues($db);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@ -1081,7 +1081,7 @@ class Cronjob extends CommonObject
|
||||
dol_syslog("We try to run a job in entity ".$this->entity." when we are in entity ".$conf->entity, LOG_WARNING);
|
||||
}
|
||||
$savcurrententity = $conf->entity;
|
||||
$conf->setEntityValues($this->entity);
|
||||
$conf->setEntityValues($this->db, $this->entity);
|
||||
dol_syslog(get_class($this)."::run_jobs entity for running job is ".$conf->entity);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
@ -1090,13 +1090,13 @@ class Cronjob extends CommonObject
|
||||
if ($result < 0) {
|
||||
$this->error = "User Error:".$user->error;
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return -1;
|
||||
} else {
|
||||
if (empty($user->id)) {
|
||||
$this->error = " User user login:".$userlogin." do not exists";
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ class Cronjob extends CommonObject
|
||||
$result = $this->update($user); // This include begin/commit
|
||||
if ($result < 0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1241,7 +1241,7 @@ class Cronjob extends CommonObject
|
||||
if ($ret === false) {
|
||||
$this->error = $langs->trans('CronCannotLoadLib').': '.$libpath;
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1250,7 +1250,7 @@ class Cronjob extends CommonObject
|
||||
$result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing
|
||||
if ($result < 0) { // If technical error
|
||||
dol_syslog(get_class($this)."::run_jobs Cannot load module langs".$langs->error, LOG_ERR);
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1316,11 +1316,11 @@ class Cronjob extends CommonObject
|
||||
$result = $this->update($user); // This include begin/commit
|
||||
if ($result < 0) {
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$conf->setEntityValues($savcurrententity);
|
||||
$conf->setEntityValues($this->db, $savcurrententity);
|
||||
return $error ?-1 : 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1470,11 +1470,11 @@ class Holiday extends CommonObject
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
//print 'month: '.$month.' lastUpdate:'.$lastUpdate.' monthLastUpdate:'.$monthLastUpdate;exit;
|
||||
|
||||
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
|
||||
// If month date is not same than the one of last update (the one we saved in database), then we update the timestamp and balance of each open user.
|
||||
if ($month != $monthLastUpdate) {
|
||||
$this->db->begin();
|
||||
|
||||
$users = $this->fetchUsers(false, false);
|
||||
$users = $this->fetchUsers(false, false, ' AND u.statut > 0');
|
||||
$nbUser = count($users);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
|
||||
@ -1675,7 +1675,7 @@ class Holiday extends CommonObject
|
||||
*
|
||||
* @param boolean $stringlist If true return a string list of id. If false, return an array with detail.
|
||||
* @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list.
|
||||
* @param string $filters Filters
|
||||
* @param string $filters Filters. Warning: This must not contains data from user input.
|
||||
* @return array|string|int Return an array
|
||||
*/
|
||||
public function fetchUsers($stringlist = true, $type = true, $filters = '')
|
||||
@ -1776,7 +1776,7 @@ class Holiday extends CommonObject
|
||||
// Si faux donc return array
|
||||
// List for Dolibarr users
|
||||
if ($type) {
|
||||
// If user of Dolibarr
|
||||
// If we need users of Dolibarr
|
||||
$sql = "SELECT";
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql .= " DISTINCT";
|
||||
|
||||
@ -890,14 +890,15 @@ if ($resql) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Add a line for total if there is a total to show
|
||||
if (!empty($arrayfields['duration']['checked'])) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="total">';
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
if ($key == 'duration') {
|
||||
print '<td class="right">'.$totalduration.' '.$langs->trans('DurationDays').'</td>';
|
||||
} else {
|
||||
print '<td/>';
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +223,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) {
|
||||
$holidaystatic->id = $obj->rowid;
|
||||
$holidaystatic->ref = $obj->ref;
|
||||
$holidaystatic->statut = $obj->status;
|
||||
$holidaystatic->date_debut = $db->jdate($obj->date_start);
|
||||
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
@ -243,7 +244,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) {
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_start), 'day').' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_end), 'day').' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
|
||||
print '<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3).'</td>';
|
||||
print '<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3, $holidaystatic->date_debut).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
|
||||
@ -66,7 +66,7 @@ echo "Test<br>\n";
|
||||
$out='';
|
||||
$ret=0;
|
||||
|
||||
$file = '/tmp/aaa';
|
||||
$file = '/tmp/test.txt';
|
||||
$f=fopen($file, 'r');
|
||||
if ($f) {
|
||||
$s=fread($f, 4096);
|
||||
@ -76,10 +76,14 @@ if ($f) {
|
||||
print "Failed to open file ".$file."<br>\n";
|
||||
}
|
||||
|
||||
exec('cat /aaa; ls /dev/std*; sleep 1;', $out, $ret);
|
||||
print '<br><br>'."\n";
|
||||
|
||||
exec('cat /test.txt; ls /dev/std*; sleep 1;', $out, $ret);
|
||||
print $ret."<br>\n";
|
||||
print_r($out);
|
||||
|
||||
print '<br><br>'."\n";
|
||||
|
||||
$ret = 0;
|
||||
$out = null;
|
||||
exec('/usr/bin/clamdscan --fdpass filethatdoesnotexists.php', $out, $ret);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user