-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiban-konversio.php
executable file
·76 lines (60 loc) · 2.12 KB
/
iban-konversio.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
72
73
74
75
76
<?php
ini_set("include_path", ini_get("include_path").PATH_SEPARATOR.dirname(__FILE__).PATH_SEPARATOR."/usr/share/pear".PATH_SEPARATOR."/usr/share/php/");
require "inc/connect.inc";
require "inc/functions.inc";
$laskuri = 0;
$query = "SELECT ultilno, swift, tilinumero, tunnus
FROM toimi
WHERE ultilno = ''
AND tilinumero not in ('', 0)";
$result = pupe_query($query);
while ($toimirow = mysqli_fetch_array($result)) {
$vastaus = luoiban(preg_replace("/[^0-9]/", "", $toimirow["tilinumero"]));
$iban = trim($vastaus["iban"]);
$bic = trim($vastaus["swift"]);
if (tarkista_iban($iban) != "" and $bic != '') {
$query = "UPDATE toimi SET
ultilno = '$iban',
swift = '$bic'
WHERE tunnus = '$toimirow[tunnus]'";
$update = pupe_query($query);
$laskuri++;
}
}
$query = "SELECT tilino, iban, bic, tunnus
FROM yriti
WHERE iban = ''";
$result = pupe_query($query);
while ($toimirow = mysqli_fetch_array($result)) {
$vastaus = luoiban(preg_replace("/[^0-9]/", "", $toimirow["tilino"]));
$iban = trim($vastaus["iban"]);
$bic = trim($vastaus["swift"]);
if (tarkista_iban($iban) != "" and $bic != '') {
$query = "UPDATE yriti SET
iban = '$iban',
bic = '$bic'
WHERE tunnus = '$toimirow[tunnus]'";
$update = pupe_query($query);
$laskuri++;
}
}
$query = "SELECT ultilno, swift, tilinumero, tunnus
FROM lasku
WHERE ultilno = ''
AND tilinumero not in ('', 0)
AND tila in ('H','M','P')";
$result = pupe_query($query);
while ($toimirow = mysqli_fetch_array($result)) {
$vastaus = luoiban(preg_replace("/[^0-9]/", "", $toimirow["tilinumero"]));
$iban = trim($vastaus["iban"]);
$bic = trim($vastaus["swift"]);
if (tarkista_iban($iban) != "" and $bic != '') {
$query = "UPDATE lasku SET
ultilno = '$iban',
swift = '$bic'
WHERE tunnus = '$toimirow[tunnus]'";
$update = pupe_query($query);
$laskuri++;
}
}
echo "\nPaivitettiin $laskuri rivia\n\n";