aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.75_pdf_logo_configuration.php
blob: 85e1d92840e9c119ee48ebdd49407c58125b161c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

class PdfLogoConfiguration extends Migration
{
    /**
     * short description of this migration
     */
    function description()
    {
        return 'adds a configuration for an optional logo for pdf-output';
    }

    /**
     * perform this migration
     */
    function up()
    {
        $options[] =
            [
            'name'        => 'PDF_LOGO',
            'type'        => 'string',
            'value'       => '',
            'section'     => 'global',
            'description' => 'Geben Sie hier den absoluten Pfad auf Ihrem Server (also ohne http) zu einem Logo an, das bei PDF-Exporten im Kopfbereich verwendet wird.'
            ];

        $stmt = DBManager::get()->prepare("
                INSERT IGNORE INTO config
                    (config_id, field, value, is_default, type, section, mkdate, chdate, description)
                VALUES
                    (MD5(:name), :name, :value, 1, :type, :section, UNIX_TIMESTAMP(),  UNIX_TIMESTAMP(), :description)
                ");

        foreach ($options as $option) {
            $stmt->execute($option);
        }
    }

    /**
     * revert this migration
     */
    function down()
    {
        $db = DBManager::get()->exec("DELETE FROM config WHERE field = 'PDF_LOGO'");
    }
}