Overview
SHA1:583fa92c76b789090a1edbf9b2e3e78fb852130c
Date: 2013-09-10 11:35:08
User: bohwaz
Comment:Le graphique des dépenses et recettes était inversé + Fix bug dans la gestion du cache statique
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2013-09-13
16:25
[1823585df4] Fix bug appel simplediff avec namespaces + espaces insécables dans les nombres (user: bohwaz, tags: trunk)
2013-09-10
11:35
[583fa92c76] Le graphique des dépenses et recettes était inversé + Fix bug dans la gestion du cache statique (user: bohwaz, tags: trunk)
2013-09-02
10:48
[eaeee5f5c5] Arrêtons d'essayer d'être intelligents, dans 90% des cas ça merde (user: bohwaz, tags: trunk)
Changes

Modified src/include/class.compta_stats.php from [dd09198417] to [016e46bf63].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
			WHERE id_categorie IN (SELECT id FROM compta_categories WHERE type = '.$type.')
			AND id_exercice = (SELECT id FROM compta_exercices WHERE cloture = 0)
			GROUP BY strftime(\'%Y-%m\', date) ORDER BY date;');
	}

	public function recettes()
	{
		return $this->_byType(-1);
	}

	public function depenses()
	{
		return $this->_byType(1);
	}

	public function soldeCompte($compte, $augmente = 'debit', $diminue = 'credit')
	{
		$db = DB::getInstance();

		if (strpos($compte, '%') !== false)







|




|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
			WHERE id_categorie IN (SELECT id FROM compta_categories WHERE type = '.$type.')
			AND id_exercice = (SELECT id FROM compta_exercices WHERE cloture = 0)
			GROUP BY strftime(\'%Y-%m\', date) ORDER BY date;');
	}

	public function recettes()
	{
		return $this->_byType(Compta_Categories::RECETTES);
	}

	public function depenses()
	{
		return $this->_byType(Compta_Categories::DEPENSES);
	}

	public function soldeCompte($compte, $augmente = 'debit', $diminue = 'credit')
	{
		$db = DB::getInstance();

		if (strpos($compte, '%') !== false)

Modified src/include/lib.static_cache.php from [9e4c6fda87] to [c7a4e63305].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
		self::$cache_dir = $dir;
		return true;
	}

	static public function store($id, $content)
	{
		$path = self::_getCachePath($id);
		return file_put_contents($path, $content);
	}

	static public function expired($id, $expire = self::EXPIRE)
	{
		$path = self::_getCachePath($id);
		$time = @filemtime($path);








|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
		self::$cache_dir = $dir;
		return true;
	}

	static public function store($id, $content)
	{
		$path = self::_getCachePath($id);
		return (bool) file_put_contents($path, $content);
	}

	static public function expired($id, $expire = self::EXPIRE)
	{
		$path = self::_getCachePath($id);
		$time = @filemtime($path);

Modified src/www/admin/compta/graph.php from [051251e8e7] to [e602a4458e].

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
110
111
112
113
114
115
116

117
118
119
120
121
122
	{
		$r = new \SVGPlot_Data($stats->recettes());
		$r->title = 'Recettes';

		$d = new \SVGPlot_Data($stats->depenses());
		$d->title = 'Dépenses';

		$data = array($r, $d);

		$plot->setTitle('Recettes et dépenses de l\'exercice courant');

		$labels = array();

		foreach ($r->get() as $k=>$v)
		{
			$labels[] = utils::date_fr('M y', strtotime(substr($k, 0, 4) . '-' . substr($k, 4, 2) .'-01'));
		}

		$plot->setLabels($labels);
	}
	elseif ($graph == 'banques_caisses')
	{
		$banques = new Compta_Comptes_Bancaires;

		$data = array();

................................................................................

	Static_Cache::store('graph_' . $graph, $plot->output());
}

header('Content-Type: image/svg+xml');
Static_Cache::display('graph_' . $graph);


if (time() % 100)
{
	Static_Cache::clean();
}

?>







|


<
<
<
<
<
<
<
<
<







 







>
|





31
32
33
34
35
36
37
38
39
40









41
42
43
44
45
46
47
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
	{
		$r = new \SVGPlot_Data($stats->recettes());
		$r->title = 'Recettes';

		$d = new \SVGPlot_Data($stats->depenses());
		$d->title = 'Dépenses';

		$data = array($d, $r);

		$plot->setTitle('Recettes et dépenses de l\'exercice courant');









	}
	elseif ($graph == 'banques_caisses')
	{
		$banques = new Compta_Comptes_Bancaires;

		$data = array();

................................................................................

	Static_Cache::store('graph_' . $graph, $plot->output());
}

header('Content-Type: image/svg+xml');
Static_Cache::display('graph_' . $graph);

// Clean cache sometimes
if ((time() % 100) == 0)
{
	Static_Cache::clean();
}

?>