forked from webERP-team/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Z_Upgrade3.10.php
84 lines (79 loc) · 3.05 KB
/
Z_Upgrade3.10.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
77
78
79
80
81
82
83
84
<?php
//$PageSecurity = 15;
include('includes/session.php');
$Title = _('Upgrade webERP to version 3.10.5');
include('includes/header.php');
prnMsg(_('This script will perform any modifications to the database since v 3.10 required to allow the additional functionality in version 3.10 scripts'),'info');
if (!isset($_POST['DoUpgrade'])) {
echo '<br /><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<div class="centre"><input type="submit" name=DoUpgrade value="' . _('Perform Upgrade') . '" /></div>';
echo '</form>';
}
if ($_POST['DoUpgrade'] == _('Perform Upgrade')){
echo '<table><tr><td>' . _('Inserting default Debtor type') . '</td>';
$sql='SELECT count(typeid)
FROM debtortype
WHERE typeid=1';
$result=DB_query($sql);
$myrow=DB_fetch_array($result);
if ($myrow[0]==0) {
$sql='INSERT INTO `debtortype` ( `typeid` , `typename` ) VALUES (1, "Default")';
$result=DB_query($sql);
if (DB_error_no()==0) {
echo '<td>' . _('Success') . '</td></tr>';
} else {
echo '<td>' . _('Failed') . '</td></tr>';
}
} else {
echo '<td>' . _('Success') . '</td></tr>';
}
echo '<tr><td>' . _('Inserting default Factor company') . '</td>';
$sql="SELECT count(id)
FROM factorcompanies
WHERE coyname='None'";
$result=DB_query($sql);
$myrow=DB_fetch_array($result);
if ($myrow[0]==0) {
$sql='INSERT INTO `factorcompanies` ( `id` , `coyname` ) VALUES (null, "None")';
$result=DB_query($sql);
if (DB_error_no()==0) {
echo '<td>' . _('Success') . '</td></tr>';
} else {
echo '<td>' . _('Failed') . '</td></tr>';
}
} else {
echo '<td>' . _('Success') . '</td></tr>';
}
echo '<tr><td>' . _('Adding quotedate to salesorders table') . '</td>';
$sql='DESCRIBE `salesorders` `quotedate`';
$result=DB_query($sql);
if (DB_num_rows($result)==0) {
$sql='ALTER TABLE `salesorders` ADD `quotedate` date NOT NULL default "0000-00-00"';
$result=DB_query($sql);
if (DB_error_no()==0) {
echo '<td>' . _('Success') . '</td></tr>';
} else {
echo '<td>' . _('Failed') . '</td></tr>';
}
} else {
echo '<td>' . _('Success') . '</td></tr>';
}
echo '<tr><td>' . _('Adding confirmeddate to salesorders table') . '</td>';
$sql='DESCRIBE `salesorders` `confirmeddate`';
$result=DB_query($sql);
if (DB_num_rows($result)==0) {
$sql="ALTER TABLE `salesorders` ADD `confirmeddate` date NOT NULL default '0000-00-00'";
$result=DB_query($sql);
if (DB_error_no()==0) {
echo '<td>' . _('Success') . '</td></tr>';
} else {
echo '<td>' . _('Failed') . '</td></tr>';
}
} else {
echo '<td>' . _('Success') . '</td></tr>';
}
echo '</table>';
}
include('includes/footer.php');
?>