-
Notifications
You must be signed in to change notification settings - Fork 132
/
mysql.2013101400.php
71 lines (62 loc) · 3.18 KB
/
mysql.2013101400.php
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/*
* LMS version 1.11-git
*
* (C) Copyright 2001-2013 LMS Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*
*/
$DB->BeginTrans();
$DB->Execute("ALTER TABLE documents ADD div_name TEXT NOT NULL DEFAULT '';"); // pełna nazwa firmy
$DB->Execute("ALTER TABLE documents ADD div_address VARCHAR (255) NOT NULL DEFAULT '';"); // adres firmy
$DB->Execute("ALTER TABLE documents ADD div_city VARCHAR (255) NOT NULL DEFAULT '';"); // miasto
$DB->Execute("ALTER TABLE documents ADD div_zip VARCHAR (255) NOT NULL DEFAULT '';"); // kod pocztowy
$DB->Execute("ALTER TABLE documents ADD div_countryid INT (11) NOT NULL DEFAULT 0;");
$DB->Execute("ALTER TABLE documents ADD div_ten VARCHAR (255) NOT NULL DEFAULT '';"); // nip
$DB->Execute("ALTER TABLE documents ADD div_regon VARCHAR (255) NOT NULL DEFAULT '';"); // regon
$DB->Execute("ALTER TABLE documents ADD div_account VARCHAR (48) NOT NULL DEFAULT '';"); // nr konta bankowego
$DB->Execute("ALTER TABLE documents ADD div_inv_header TEXT NOT NULL DEFAULT '';"); // nagłówek faktury
$DB->Execute("ALTER TABLE documents ADD div_inv_footer TEXT NOT NULL DEFAULT '';"); // stopka faktury
$DB->Execute("ALTER TABLE documents ADD div_inv_author TEXT NOT NULL DEFAULT '';"); // kto wystawił
$DB->Execute("ALTER TABLE documents ADD div_inv_cplace TEXT NOT NULL DEFAULT '';"); // miejsce wystawienia
$dl = $DB->GetAll('SELECT id, name, address, city, zip, countryid, ten, regon,
account, inv_header, inv_footer, inv_author, inv_cplace
FROM divisions;');
$count = sizeof($dl);
if ($dl) for ($i=0; $i<$count; $i++) {
$DB->Execute("UPDATE documents SET div_name = ?, div_address = ?, div_city = ?, div_zip = ?,
div_countryid = ?, div_ten = ?, div_regon = ?, div_account = ?, div_inv_header = ?,
div_inv_footer = ?, div_inv_author = ?, div_inv_cplace = ?
WHERE divisionid = ? ;",array(
($dl[$i]['name'] ? $dl[$i]['name'] : ''),
($dl[$i]['address'] ? $dl[$i]['address'] : ''),
($dl[$i]['city'] ? $dl[$i]['city'] : ''),
($dl[$i]['zip'] ? $dl[$i]['zip'] : ''),
($dl[$i]['countryid'] ? $dl[$i]['countryid'] : 0),
($dl[$i]['ten'] ? $dl[$i]['ten'] : ''),
($dl[$i]['regon'] ? $dl[$i]['regon'] : ''),
($dl[$i]['account'] ? $dl[$i]['account'] : ''),
($dl[$i]['inv_header'] ? $dl[$i]['inv_header'] : ''),
($dl[$i]['inv_footer'] ? $dl[$i]['inv_footer'] : ''),
($dl[$i]['inv_author'] ? $dl[$i]['inv_author'] : ''),
($dl[$i]['inv_cplace'] ? $dl[$i]['inv_cplace'] : ''),
$dl[$i]['id']
)
);
}
$DB->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2013101400', 'dbversion'));
$DB->CommitTrans();
?>