Skip to content
Snippets Groups Projects
Commit 5187ffcc authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

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

parents 4e86e59f 7600a10f
No related branches found
No related tags found
No related merge requests found
......@@ -2,15 +2,6 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
WARNING:
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection" during
migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying
make a Dolibarr upgrade.
***** ChangeLog for 5.0.0 compared to 4.0.* *****
......
This diff is collapsed.
......@@ -675,8 +675,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
}
// Clean some parameters
if (! empty($_POST["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (! empty($_POST["localtax2_type"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
if ((! empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if ((! empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
......@@ -1064,7 +1064,9 @@ if ($id)
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
if ($id == 2) // Special cas for state page
{
if ($fieldlist[$field]=='region_id') { $valuetoshow='&nbsp;'; $showfield=1; }
......
......@@ -849,25 +849,49 @@ class Holiday extends CommonObject
* Return value of a conf parameterfor leave module
* TODO Move this into llx_const table
*
* @param string $name name of parameter
* @return string value of parameter
* @param string $name Name of parameter
* @param string $createifnotfound 'stringvalue'=Create entry with string value if not found. For example 'YYYYMMDDHHMMSS'.
* @return string Value of parameter. Example: 'YYYYMMDDHHMMSS' or < 0 if error
*/
function getConfCP($name)
function getConfCP($name, $createifnotfound='')
{
$sql = "SELECT value";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
$sql.= " WHERE name = '".$name."'";
dol_syslog(get_class($this).'::getConfCP name='.$name.'', LOG_DEBUG);
dol_syslog(get_class($this).'::getConfCP name='.$name.' createifnotfound='.$createifnotfound, LOG_DEBUG);
$result = $this->db->query($sql);
// Si pas d'erreur
if($result) {
$objet = $this->db->fetch_object($result);
// Retourne la valeur
return $objet->value;
$obj = $this->db->fetch_object($result);
// Return value
if (empty($obj))
{
if ($createifnotfound)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_config(name, value)";
$sql.= " VALUES('".$name."', '".$createifnotfound."')";
$result = $this->db->query($sql);
if ($result)
{
return $createifnotfound;
}
else
{
$this->error=$this->db->lasterror();
return -2;
}
}
else
{
return '';
}
}
else
{
return $obj->value;
}
} else {
// Erreur SQL
......@@ -896,11 +920,12 @@ class Holiday extends CommonObject
$now=dol_now();
$month = date('m',$now);
$newdateforlastupdate = dol_print_date($now, '%Y%m%d%H%M%S');
// Get month of last update
$lastUpdate = $this->getConfCP('lastUpdate');
$lastUpdate = $this->getConfCP('lastUpdate', $newdateforlastupdate);
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;exit;
//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 != $monthLastUpdate)
......@@ -911,9 +936,8 @@ class Holiday extends CommonObject
$nbUser = count($users);
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET";
$sql.= " value = '".dol_print_date($now,'%Y%m%d%H%M%S')."'";
$sql.= " value = '".$newdateforlastupdate."'";
$sql.= " WHERE name = 'lastUpdate'";
$result = $this->db->query($sql);
$typeleaves=$this->getTypes(1,1);
......
......@@ -62,6 +62,12 @@ if ($user->societe_id > 0) accessforbidden();
$holiday = new Holiday($db);
$holidaystatic=new Holiday($db);
// Update sold
if (! empty($conf->holiday->enabled))
{
$result = $holiday->updateBalance();
}
$childids = $user->getAllChildIds();
$childids[]=$user->id;
......@@ -145,8 +151,7 @@ $langs->load("boxes");
// Last leave requests
if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
{
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.photo, u.statut,";
$sql.= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.photo, u.statut, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = x.fk_user";
$sql.= " AND x.entity = ".$conf->entity;
......@@ -183,25 +188,23 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
$holidaystatic->id=$obj->rowid;
$holidaystatic->ref=$obj->ref;
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;
$userstatic->login=$obj->login;
$userstatic->photo=$obj->photo;
$userstatic->statut=$obj->statut;
$starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning';
$endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon';
print '<tr '.$bc[$var].'>';
print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>';
print '<td>'.$typeleaves[$obj->fk_type]['label'].'</td>';
print '<td>'.dol_print_date($obj->date_start,'day').' '.$langs->trans($listhalfday[$starthalfday]);
$starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning';
$endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon';
print '<td>'.dol_print_date($obj->date_start,'day').' '.$langs->trans($listhalfday[$endhalfday]);
print '<td>'.dol_print_date($obj->date_end,'day').' '.$langs->trans($listhalfday[$endhalfday]);
print '<td align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
print '<td>'.$holidaystatic->LibStatut($obj->status,3).'</td>';
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment