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

This commit is contained in:
Laurent Destailleur 2016-12-12 13:03:37 +01:00
commit 5187ffcc9a
6 changed files with 8792 additions and 35 deletions

View File

@ -2,15 +2,6 @@
English Dolibarr ChangeLog 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.* ***** ***** ChangeLog for 5.0.0 compared to 4.0.* *****

File diff suppressed because one or more lines are too long

View File

@ -675,8 +675,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
} }
// Clean some parameters // Clean some parameters
if (! empty($_POST["localtax1_type"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='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"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='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"] <= 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_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 if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
@ -1064,6 +1064,8 @@ if ($id)
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); } if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } 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 ($id == 2) // Special cas for state page
{ {

View File

@ -849,25 +849,49 @@ class Holiday extends CommonObject
* Return value of a conf parameterfor leave module * Return value of a conf parameterfor leave module
* TODO Move this into llx_const table * TODO Move this into llx_const table
* *
* @param string $name name of parameter * @param string $name Name of parameter
* @return string value 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 = "SELECT value";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_config"; $sql.= " FROM ".MAIN_DB_PREFIX."holiday_config";
$sql.= " WHERE name = '".$name."'"; $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); $result = $this->db->query($sql);
// Si pas d'erreur
if($result) { if($result) {
$objet = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
// Retourne la valeur // Return value
return $objet->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 { } else {
// Erreur SQL // Erreur SQL
@ -896,11 +920,12 @@ class Holiday extends CommonObject
$now=dol_now(); $now=dol_now();
$month = date('m',$now); $month = date('m',$now);
$newdateforlastupdate = dol_print_date($now, '%Y%m%d%H%M%S');
// Get month of last update // Get month of last update
$lastUpdate = $this->getConfCP('lastUpdate'); $lastUpdate = $this->getConfCP('lastUpdate', $newdateforlastupdate);
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5]; $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 // Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
if ($month != $monthLastUpdate) if ($month != $monthLastUpdate)
@ -911,9 +936,8 @@ class Holiday extends CommonObject
$nbUser = count($users); $nbUser = count($users);
$sql = "UPDATE ".MAIN_DB_PREFIX."holiday_config SET"; $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'"; $sql.= " WHERE name = 'lastUpdate'";
$result = $this->db->query($sql); $result = $this->db->query($sql);
$typeleaves=$this->getTypes(1,1); $typeleaves=$this->getTypes(1,1);

View File

@ -62,6 +62,12 @@ if ($user->societe_id > 0) accessforbidden();
$holiday = new Holiday($db); $holiday = new Holiday($db);
$holidaystatic=new Holiday($db); $holidaystatic=new Holiday($db);
// Update sold
if (! empty($conf->holiday->enabled))
{
$result = $holiday->updateBalance();
}
$childids = $user->getAllChildIds(); $childids = $user->getAllChildIds();
$childids[]=$user->id; $childids[]=$user->id;
@ -145,8 +151,7 @@ $langs->load("boxes");
// Last leave requests // Last leave requests
if (! empty($conf->holiday->enabled) && $user->rights->holiday->read) 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 = "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.= " 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.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = x.fk_user"; $sql.= " WHERE u.rowid = x.fk_user";
$sql.= " AND x.entity = ".$conf->entity; $sql.= " AND x.entity = ".$conf->entity;
@ -183,25 +188,23 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
while ($i < $num && $i < $max) while ($i < $num && $i < $max)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$holidaystatic->id=$obj->rowid; $holidaystatic->id=$obj->rowid;
$holidaystatic->ref=$obj->ref; $holidaystatic->ref=$obj->ref;
$userstatic->id=$obj->uid; $userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname; $userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname; $userstatic->firstname=$obj->firstname;
$userstatic->login=$obj->login; $userstatic->login=$obj->login;
$userstatic->photo=$obj->photo; $userstatic->photo=$obj->photo;
$userstatic->statut=$obj->statut; $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 '<tr '.$bc[$var].'>';
print '<td>'.$holidaystatic->getNomUrl(1).'</td>'; print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>'; print '<td>'.$userstatic->getNomUrl(-1, 'leave').'</td>';
print '<td>'.$typeleaves[$obj->fk_type]['label'].'</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>'.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 align="right">'.dol_print_date($db->jdate($obj->dm),'day').'</td>';
print '<td>'.$holidaystatic->LibStatut($obj->status,3).'</td>'; print '<td>'.$holidaystatic->LibStatut($obj->status,3).'</td>';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 385 B