Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
3
    /**
4
     * @package   teile-freak
5
     * @author    Lars Tiefland <tiefland@weban.de>
6
     * @copyright 2010 Webagentur Niewerth
7
     * @license   propietary http://www.weban.de
8
     * @version   $Rev: 913 $
9
     * @filesource
10
     *
11
     */
12
 
13
    /**
14
     *
15
     * @package   teile-freak
16
     * @author    Lars Tiefland <tiefland@weban.de>
17
     * @copyright 2010 Webagentur Niewerth
18
     */
19
 
20
    // SVN: $Id: getOrderDetails.php 913 2012-01-25 12:47:30Z tiefland $
21
 
22
    // deutsche Umgebung
23
    setlocale( LC_ALL, "de_DE" );
24
    // Connect-Datei einbinden
25
    define( "modul_name", "Warenwirtschaft" );
26
    define( "tool_name", "bestellung" );
27
    require_once "../Online-Shop/connect2.php";
28
    $GLOBALS["web_rechte"] = $web_rechte;
29
    require_once "Weban_Smarty.class.php";
30
    require_once "includes/bestellungen/system/artikelDatabase.php";
31
 
32
    $GLOBALS["ui"] = new Weban_Smarty();
33
 
34
    if ( isset( $_GET["id"] ) )
35
    {
36
        $data = view_order( $_GET["id"] );
37
        $GLOBALS["ui"]->assign( "order", $data );
38
        $GLOBALS["ui"]->display( "view_order.tpl" );
39
    }
40
 
41
    function view_order( $id )
42
    {
43
        $sql = "SELECT
44
                shops_id
45
            FROM
46
                Bestellung
47
            WHERE
48
                id = $id
49
        ";
50
        $res = mysql_query($sql);
51
        $row = mysql_fetch_assoc($res);
52
        $shop = $row["shops_id"];
53
        $db = shopDatabase( $shop );
54
        $ab_table = "artikel_to_Bestellung ab";
55
        $b_table = "Bestellung b";
56
        $a_table = $db . "artikel a";
57
        $sql = "SELECT
58
                b.ID,
59
                b.shops_ID,
60
                b.erstellt_am,
61
                b.letzte_aenderung_am,
62
        ";
63
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["waehrung"] ) )
64
        {
65
            $sql .= "
66
                    c.locale,
67
                ";
68
        }
69
        $sql .= "
70
                b.letzte_aenderung_von
71
            FROM
72
                $b_table,
73
        ";
74
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["waehrung"] ) )
75
        {
76
            $sql .= "
77
                        currencies c,
78
                ";
79
        }
80
        $sql .= "
81
                $ab_table
82
            JOIN
83
                $a_table
84
            ON
85
                a.ID=ab.artikel
86
            WHERE
87
                b.ID = $id
88
            AND
89
                ab.Bestellung=b.ID
90
        ";
91
        if ( isset( $GLOBALS["web_rechte"]["Warenwirtschaft"]["bestellung"]["waehrung"] ) )
92
        {
93
            $sql .= "
94
            AND
95
                c.id=b.currency
96
        ";
97
        }
98
        $res = mysql_query( $sql );
99
        $row = mysql_fetch_assoc( $res );
100
        $sql = "SELECT
101
                ab.*,
102
                a.kennung,
103
                a.kurzbezeichnung,
104
                a.Father,
105
                Menge * Preis_pro_Stueck AS gesamtpreis
106
            FROM
107
                $ab_table
108
            LEFT JOIN
109
                $a_table
110
            ON
111
                a.ID=ab.artikel
112
            WHERE
113
                ab.Bestellung=$id
114
        ";
115
        $res = mysql_query( $sql );
116
        while ( $ab_row = mysql_fetch_assoc( $res ) )
117
        {
118
            /*if ( $ab_row["Father"] == -3 )
119
            {
120
            $item = getItem( $ab_row["artikel"], false, true );
121
            }
122
            else
123
            {
124
            $item = getItem( $ab_row["artikel"] );
125
            }*/
126
            $ab_row["Bezeichnung"] = trim( $ab_row["Bezeichnung"] );
127
            $ab_row["itemLink"] = $item["itemLink"];
128
            $ab_row["father"] = $item["Father"];
129
            $row["items"][] = $ab_row;
130
        }
131
        return $row;
132
    }
133
?>