Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/compta/facture.php
	htdocs/product/stock/product.php
This commit is contained in:
Laurent Destailleur 2015-04-08 20:43:51 +02:00
commit ca7a7a9038
3 changed files with 27 additions and 22 deletions

View File

@ -1076,7 +1076,7 @@ if (empty($reshook))
$lines[$i]->fetch_optionals($lines[$i]->rowid); $lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options; $array_options = $lines[$i]->array_options;
} }
// View third's localtaxes for now // View third's localtaxes for now
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client);
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client);

View File

@ -31,7 +31,7 @@ abstract class Stats
{ {
protected $db; protected $db;
var $_lastfetchdate=array(); // Dates of cache file read by methods var $_lastfetchdate=array(); // Dates of cache file read by methods
var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
/** /**
* Return nb of elements by month for several years * Return nb of elements by month for several years
@ -76,7 +76,7 @@ abstract class Stats
dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it.");
} }
} }
// Load file into $data // Load file into $data
if ($foundintocache) // Cache file found and is not too old if ($foundintocache) // Cache file found and is not too old
{ {
@ -203,11 +203,14 @@ abstract class Stats
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
$fp = fopen($newpathofdestfile, 'w'); $fp = fopen($newpathofdestfile, 'w');
fwrite($fp, json_encode($data)); if ($fp)
fclose($fp); {
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; fwrite($fp, json_encode($data));
@chmod($newpathofdestfile, octdec($newmask)); fclose($fp);
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
}
else dol_syslog("Failed to write cache file", LOG_ERR);
$this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
} }
@ -309,21 +312,23 @@ abstract class Stats
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
$fp = fopen($newpathofdestfile, 'w'); $fp = fopen($newpathofdestfile, 'w');
fwrite($fp, json_encode($data)); if ($fp)
fclose($fp); {
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; fwrite($fp, json_encode($data));
@chmod($newpathofdestfile, octdec($newmask)); fclose($fp);
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
}
$this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
} }
return $data; return $data;
} }
// Here we have low level of shared code called by XxxStats.class.php // Here we have low level of shared code called by XxxStats.class.php
/** /**
* Return nb of elements by year * Return nb of elements by year
* *
@ -532,8 +537,8 @@ abstract class Stats
return $data; return $data;
} }
/** /**
* Return number or total of product refs * Return number or total of product refs
* *
@ -544,7 +549,7 @@ abstract class Stats
function _getAllByProduct($sql, $limit=10) function _getAllByProduct($sql, $limit=10)
{ {
global $langs; global $langs;
$result=array(); $result=array();
$res=array(); $res=array();
@ -567,6 +572,6 @@ abstract class Stats
else dol_print_error($this->db); else dol_print_error($this->db);
return $result; return $result;
} }
} }

View File

@ -413,7 +413,7 @@ else
} }
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre nodrag nodrop">';
// print '<td>'.$langs->trans("Project").'</td>'; // print '<td>'.$langs->trans("Project").'</td>';
print '<td width="100">'.$langs->trans("RefTask").'</td>'; print '<td width="100">'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>'; print '<td>'.$langs->trans("LabelTask").'</td>';