Renamed ifSqlHasZeroNums() to ifSqlHasZeroNumRows() and improved some queries.
[mailer.git] / inc / modules / admin / what-list_bank_package.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 02/12/2004 *
4  * ===================                          Last change: 02/12/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-list_bank_package.php                       *
8  * -------------------------------------------------------------------- *
9  * Short description : List packages                                    *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Listet Angebotspakete auf                        *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
40         die();
41 } // END - if
42
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
45
46 // Check if there is enougth selected
47 $show = TRUE;
48 if (ifPostContainsSelections('id')) {
49         // Okay, which button was pressed?
50         if (isFormSent('change')) {
51                 // Change permissions
52                 adminChangeActivationStatus(postRequestElement('id'), 'bank_packages', 'package_active');
53         } elseif (isFormSent('edit')) {
54                 // Delete entries (with confirmation)
55                 adminEditEntriesConfirm(
56                         array('id'),
57                         array('bank_packages'),
58                         postRequestElement('id'),
59                         array(
60                                 'id',
61                                 'title',
62                                 'description',
63                                 'account_fee',
64                                 'free_transfers',
65                                 'transfer_fee',
66                                 'output_system_mode',
67                                 'package_active',
68                                 'free_months_no_fee',
69                                 'interest_plus',
70                                 'interest_minus',
71                                 'first_payment',
72                                 'free_account_income',
73                                 'free_account_stuff',
74                                 'tan_lock'
75                         ),
76                         array(
77                                 'bigintval',
78                                 '',
79                                 '',
80                                 'translateComma',
81                                 'bigintval',
82                                 'translateComma',
83                                 '',
84                                 '',
85                                 'bigintval',
86                                 'translateComma',
87                                 'translateComma',
88                                 'translateComma',
89                                 'translateComma',
90                                 '',
91                                 'bigintval'
92                         ),
93                         array(
94                                 '',
95                                 '',
96                                 '',
97                                 '',
98                                 '',
99                                 '',
100                                 '',
101                                 '',
102                                 '',
103                                 '',
104                                 '',
105                                 '',
106                                 '',
107                                 '',
108                                 ''
109                         )
110                 );
111                 $show = FALSE;
112         } elseif (isFormSent('do_edit')) {
113                 // Delete entries (with confirmation)
114                 adminEditEntriesConfirm(
115                         array('id'),
116                         array('bank_packages'),
117                         postRequestElement('id'),
118                         array(),
119                         array(),
120                         array(),
121                         array(TRUE)
122                 );
123         } elseif (isFormSent('delete')) {
124                 // Delete entries (with confirmation)
125                 adminDeleteEntriesConfirm(
126                         array('id'),
127                         array('bank_packages'),
128                         postRequestElement('id'),
129                         array(
130                                 'id',
131                                 'title',
132                                 'description',
133                                 'account_fee'
134                         ),
135                         array(
136                                 'bigintval',
137                                 '',
138                                 '',
139                                 'translateComma'
140                         ),
141                         array(
142                                 '',
143                                 '',
144                                 '',
145                                 ''
146                         )
147                 );
148                 $show = FALSE;
149         } elseif (isFormSent('do_delete')) {
150                 // Delete entries (with confirmation)
151                 adminDeleteEntriesConfirm(
152                         array('id'),
153                         array('bank_packages'),
154                         postRequestElement('id'),
155                         array(),
156                         array(),
157                         array(),
158                         array(TRUE)
159                 );
160         }
161 } // END - if
162
163 // Skip showing old entries?
164 if ($show === FALSE) return;
165
166 // Load all banking packages from DB
167 $result = sqlQuery('SELECT
168         `id`,
169         `title`,
170         `description`,
171         `account_fee`,
172         `package_active`,
173         `interest_plus`,
174         `interest_minus`
175 FROM
176         `{?_MYSQL_PREFIX?}_bank_packages`
177 ORDER BY
178         `id` ASC', __FILE__, __LINE__);
179
180 // Is there at lease one package?
181 if (!ifSqlHasZeroNumRows($result)) {
182         // List all packages
183         $OUT = '';
184         while ($content = sqlFetchArray($result)) {
185                 // Load row template
186                 $OUT .= loadTemplate('admin_list_bank_package_row', TRUE, $content);
187         } // END - while
188
189         // Load main template
190         loadTemplate('admin_list_bank_package', FALSE, $OUT);
191 } else {
192         // No packages found
193         displayMessage('{--ADMIN_BANK_NO_PACKAGES_FOUND--}');
194 }
195
196 // Free the result
197 sqlFreeResult($result);
198
199 // [EOF]
200 ?>