Overview
Comment:Corrections liées à des variables inutilisées
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: 8f90c2ba0d3ad6d93b55209e1be3d86635f3a719
User & Date: bohwaz on 2018-07-11 19:50:07
Other Links: manifest | tags
Context
2018-07-11
19:52
Nouvelle release check-in: 49ba465405 user: bohwaz tags: trunk, stable, 0.8.5
19:50
Corrections liées à des variables inutilisées check-in: 8f90c2ba0d user: bohwaz tags: trunk, stable
19:49
Corrige gestion du LOCAL_LOGIN dans le cas où le cookie n'est pas vide mais la session plus valide check-in: 3ddbc77ebb user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Compta/Exercices.php from [f9841e58c7] to [40f25a7060].

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
     * et les inscrire au résultat de l'exercice N+1
     * @param  integer  $exercice   ID de l'exercice à solder
     * @param  string   $date       Date de début de l'exercice Y-m-d
     * @return boolean              true en cas de succès
     */
    public function solderResultat($exercice, $date)
    {
        $db = DB::getInstance();

        $resultat_excedent = 120;
        $resultat_debiteur = 129;

        $comptes = new Comptes;

        if (!$comptes->isActive($resultat_excedent))
        {







<
<







212
213
214
215
216
217
218


219
220
221
222
223
224
225
     * et les inscrire au résultat de l'exercice N+1
     * @param  integer  $exercice   ID de l'exercice à solder
     * @param  string   $date       Date de début de l'exercice Y-m-d
     * @return boolean              true en cas de succès
     */
    public function solderResultat($exercice, $date)
    {


        $resultat_excedent = 120;
        $resultat_debiteur = 129;

        $comptes = new Comptes;

        if (!$comptes->isActive($resultat_excedent))
        {

Modified src/include/lib/Garradin/Compta/Import.php from [434894af9b] to [256fecd4fb].

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
		if (!$fp)
		{
			return false;
		}

		$db = DB::getInstance();
		$db->begin();
		$comptes = new Comptes;
		$banques = new Comptes_Bancaires;
		$cats = new Categories;
		$journal = new Journal;

		$columns = array_flip($this->csv_header);
		$liste_comptes = $db->getAssoc('SELECT id, id FROM compta_comptes;');
		$liste_cats = $db->getAssoc('SELECT intitule, id FROM compta_categories;');
		$liste_moyens = $cats->listMoyensPaiement();

		$col = function($column) use (&$row, &$columns)
		{
			if (!isset($columns[$column]))
				return null;







<
<




<







101
102
103
104
105
106
107


108
109
110
111

112
113
114
115
116
117
118
		if (!$fp)
		{
			return false;
		}

		$db = DB::getInstance();
		$db->begin();


		$cats = new Categories;
		$journal = new Journal;

		$columns = array_flip($this->csv_header);

		$liste_cats = $db->getAssoc('SELECT intitule, id FROM compta_categories;');
		$liste_moyens = $cats->listMoyensPaiement();

		$col = function($column) use (&$row, &$columns)
		{
			if (!isset($columns[$column]))
				return null;

Modified src/include/lib/Garradin/Compta/Rapports.php from [4805222cc1] to [193a79d665].

238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
            WHERE compte IN (SELECT id FROM compta_comptes WHERE position IN ('.implode(', ', $include).'))
            ORDER BY compte ASC;');

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            list($compte, $debit, $credit, $position) = $row;
            $parent = substr($compte, 0, 2);
            $classe = $compte[0];

            if (($position & Comptes::ACTIF) && ($position & Comptes::PASSIF))
            {
                $position = 'actif_ou_passif';
                $solde = $debit - $credit;
            }
            else if ($position & Comptes::ACTIF)







<







238
239
240
241
242
243
244

245
246
247
248
249
250
251
            WHERE compte IN (SELECT id FROM compta_comptes WHERE position IN ('.implode(', ', $include).'))
            ORDER BY compte ASC;');

        while ($row = $res->fetchArray(SQLITE3_NUM))
        {
            list($compte, $debit, $credit, $position) = $row;
            $parent = substr($compte, 0, 2);


            if (($position & Comptes::ACTIF) && ($position & Comptes::PASSIF))
            {
                $position = 'actif_ou_passif';
                $solde = $debit - $credit;
            }
            else if ($position & Comptes::ACTIF)

Modified src/include/lib/Garradin/Compta/Rapprochement.php from [4eec0ce21a] to [dbf2a90fad].

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
        }

        $solde_final = $solde;

        return $result;
    }

    public function record($compte, array $journal, array $cases = null, $id_auteur)
    {
        if (!is_array($cases) && empty($cases))
        {
            $cases = [];
        }

        $db = DB::getInstance();







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
        }

        $solde_final = $solde;

        return $result;
    }

    public function record(array $journal, array $cases = null, $id_auteur)
    {
        if (!is_array($cases) && empty($cases))
        {
            $cases = [];
        }

        $db = DB::getInstance();

Modified src/include/lib/Garradin/Install.php from [1ed25c3eb1] to [6badb0a7e2].

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

		// Configuration de base
		// c'est dans Config::set que sont vérifiées les données utilisateur (renvoie UserException)
		$config = Config::getInstance();
		$config->set('nom_asso', $nom_asso);
		$config->set('adresse_asso', $adresse_asso);
		$config->set('email_asso', $email_asso);
		$config->set('site_asso', WWW_URL);
		$config->set('monnaie', '€');
		$config->set('pays', 'FR');
		$config->set('email_envoi_automatique', $email_asso);
		$config->setVersion(garradin_version());

		$champs = Membres\Champs::importInstall();
		$champs->save(false); // Pas de copie car pas de table membres existante







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

		// Configuration de base
		// c'est dans Config::set que sont vérifiées les données utilisateur (renvoie UserException)
		$config = Config::getInstance();
		$config->set('nom_asso', $nom_asso);
		$config->set('adresse_asso', $adresse_asso);
		$config->set('email_asso', $email_asso);
		$config->set('site_asso', $site_asso);
		$config->set('monnaie', '€');
		$config->set('pays', 'FR');
		$config->set('email_envoi_automatique', $email_asso);
		$config->setVersion(garradin_version());

		$champs = Membres\Champs::importInstall();
		$champs->save(false); // Pas de copie car pas de table membres existante

Modified src/include/lib/Garradin/Rappels_Envoyes.php from [c7cead62f7] to [4ab2f9f384].

193
194
195
196
197
198
199
200

201
202
203
204
205
206
207
	 */
	public function listForCotisation($id, $page = 1)
	{
		$begin = ($page - 1) * self::ITEMS_PER_PAGE;

		return DB::getInstance()->get('SELECT * FROM rappels_envoyes
			WHERE id_rappel IN (SELECT id FROM rappels WHERE id_cotisation = ?)
			ORDER BY date DESC;', (int)$id);

	}

	/**
	 * Nombre de rappels pour une cotisation donnée
	 * @param  integer $id Numéro de la cotisation
	 * @return integer Nombre de rappels envoyés
	 */







|
>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
	 */
	public function listForCotisation($id, $page = 1)
	{
		$begin = ($page - 1) * self::ITEMS_PER_PAGE;

		return DB::getInstance()->get('SELECT * FROM rappels_envoyes
			WHERE id_rappel IN (SELECT id FROM rappels WHERE id_cotisation = ?)
			ORDER BY date DESC
			LIMIT ?, ?;', (int)$id, $begin, self::ITEMS_PER_PAGE);
	}

	/**
	 * Nombre de rappels pour une cotisation donnée
	 * @param  integer $id Numéro de la cotisation
	 * @return integer Nombre de rappels envoyés
	 */

Modified src/include/lib/Garradin/Squelette.php from [55a9f0b312] to [63f2767bad].

498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
            }
        }
        else if ($loopType == 'documents' || $loopType == 'images' || $loopType == 'fichiers')
        {
            $where = $order = '';
            $limit = $begin = 0;

            $link = false;

            $query = 'SELECT f.*, fc.hash, fc.taille, strftime(\'%s\', f.datetime) AS date ';
            $query.= ' FROM fichiers AS f INNER JOIN fichiers_contenu AS fc ON fc.id = f.id_contenu ';
            $query.= ' INNER JOIN fichiers_wiki_pages AS fwp ON fwp.fichier = f.id ';
            $query.= ' INNER JOIN wiki_pages AS w ON w.id = fwp.id AND w.droit_lecture = -1 ';
            $where = 'WHERE 1 ';

            $allowed_fields = ['id', 'nom', 'type', 'date', 'image', 'hash', 'taille',







<
<







498
499
500
501
502
503
504


505
506
507
508
509
510
511
            }
        }
        else if ($loopType == 'documents' || $loopType == 'images' || $loopType == 'fichiers')
        {
            $where = $order = '';
            $limit = $begin = 0;



            $query = 'SELECT f.*, fc.hash, fc.taille, strftime(\'%s\', f.datetime) AS date ';
            $query.= ' FROM fichiers AS f INNER JOIN fichiers_contenu AS fc ON fc.id = f.id_contenu ';
            $query.= ' INNER JOIN fichiers_wiki_pages AS fwp ON fwp.fichier = f.id ';
            $query.= ' INNER JOIN wiki_pages AS w ON w.id = fwp.id AND w.droit_lecture = -1 ';
            $where = 'WHERE 1 ';

            $allowed_fields = ['id', 'nom', 'type', 'date', 'image', 'hash', 'taille',

Modified src/include/lib/Garradin/Squelette_Filtres.php from [4eee7b88b4] to [b4203fb585].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

namespace Garradin;

class Squelette_Filtres
{
    static private $g2x = null;
    static private $alt = [];

    static public $filtres_php = [
        'strtolower',
        'strtoupper',
        'ucfirst',
        'ucwords',






<







1
2
3
4
5
6

7
8
9
10
11
12
13
<?php

namespace Garradin;

class Squelette_Filtres
{

    static private $alt = [];

    static public $filtres_php = [
        'strtolower',
        'strtoupper',
        'ucfirst',
        'ucwords',
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
    static public function div($a, $b)
    {
        return $b ? $a / $b : 0;
    }

    static public function modulo($a, $mod, $add)
    {
        return ($mod ? $nb % $mod : 0) + $add;
    }

    static public function vide($value)
    {
        return '';
    }








|







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    static public function div($a, $b)
    {
        return $b ? $a / $b : 0;
    }

    static public function modulo($a, $mod, $add)
    {
        return ($mod ? $a % $mod : 0) + $add;
    }

    static public function vide($value)
    {
        return '';
    }

Modified src/include/lib/Garradin/Utils.php from [cb5d0acf56] to [7d0bf46225].

629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
            return str_replace('.', ',', round($size / 1024 / 1024, 2)) . ' Mo';
        elseif ($size > 1024)
            return str_replace('.', ',', round($size / 1024, 2)) . ' Ko';
        else
            return $size . ' o';
    }

    static public function deleteRecursive($path, $delete_target = false)
    {
        if (!file_exists($path))
            return false;

        $dir = dir($path);
        if (!$dir) return false;

        while ($file = $dir->read())
        {
            if ($file == '.' || $file == '..')
                continue;

            if (is_dir($path . '/' . $file))
            {
                if (!self::deleteRecursive($path . '/' . $file, true))
                    return false;
            }
            else
            {
                unlink($path . '/' . $file);
            }
        }







|














|







629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
            return str_replace('.', ',', round($size / 1024 / 1024, 2)) . ' Mo';
        elseif ($size > 1024)
            return str_replace('.', ',', round($size / 1024, 2)) . ' Ko';
        else
            return $size . ' o';
    }

    static public function deleteRecursive($path)
    {
        if (!file_exists($path))
            return false;

        $dir = dir($path);
        if (!$dir) return false;

        while ($file = $dir->read())
        {
            if ($file == '.' || $file == '..')
                continue;

            if (is_dir($path . '/' . $file))
            {
                if (!self::deleteRecursive($path . '/' . $file))
                    return false;
            }
            else
            {
                unlink($path . '/' . $file);
            }
        }

Modified src/include/lib/Garradin/Wiki.php from [ea67414504] to [d68669124c].

429
430
431
432
433
434
435
436

437
438
439
440
441
442
443
        $db = DB::getInstance();

        return $db->get('SELECT *,
                strftime(\'%s\', date_creation) AS date_creation,
                strftime(\'%s\', date_modification) AS date_modification
                FROM wiki_pages
                WHERE '.$this->_getLectureClause().'
                ORDER BY date_modification DESC;');

    }

    public function countRecentModifications()
    {
        $db = DB::getInstance();
        return $db->firstColumn('SELECT COUNT(*) FROM wiki_pages WHERE '.$this->_getLectureClause().';');
    }







|
>







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
        $db = DB::getInstance();

        return $db->get('SELECT *,
                strftime(\'%s\', date_creation) AS date_creation,
                strftime(\'%s\', date_modification) AS date_modification
                FROM wiki_pages
                WHERE '.$this->_getLectureClause().'
                ORDER BY date_modification DESC
                LIMIT ?,?;', $begin, self::ITEMS_PER_PAGE);
    }

    public function countRecentModifications()
    {
        $db = DB::getInstance();
        return $db->firstColumn('SELECT COUNT(*) FROM wiki_pages WHERE '.$this->_getLectureClause().';');
    }