/
company_profile.php
105 lines (101 loc) · 3.8 KB
/
company_profile.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?
/**
*
* Copyright (C) 2003-2011 Cory Powers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
require_once('includes/common.php');
require_once('includes/SI_Company.php');
checkLogin();
$title = '';
$company = new SI_Company();
$title = "Edit Company";
if($loggedin_user->isDeveloper() && !empty($_REQUEST['id'])){
$id = $_REQUEST['id'];
}else{
$id = $loggedin_user->company_id;
}
if(!$company->get($id)){
$error_msg .= "Error retrieving company information!\n";
debug_message($company->getLastError());
}
if($_POST['save']){
$company->updateFromAssocArray($_POST);
if($company->update()){
goBack();
}else{
$error_msg .= "Error updating Company!\n";
debug_message($company->getLastError());
}
}
?>
<? require('header.php'); ?>
<FORM ACTION="<?= $_SERVER['PHP_SELF'] ?>" METHOD="POST">
<INPUT NAME="id" TYPE="hidden" VALUE="<?= $id ?>">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" CLASS="form_table">
<TR>
<TD COLSPAN="2" CLASS="form_header_cell"><?= $title ?></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Name:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="name" CLASS="input_text" SIZE="25" TYPE="text" VALUE="<?= $company->name ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Address Line 1:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="address1" CLASS="input_text" SIZE="35" TYPE="text" VALUE="<?= $company->address1 ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Address Line 2:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="address2" CLASS="input_text" SIZE="35" TYPE="text" VALUE="<?= $company->address2 ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">City:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="city" CLASS="input_text" SIZE="35" TYPE="text" VALUE="<?= $company->city ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">State:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="state" CLASS="input_text" SIZE="5" TYPE="text" VALUE="<?= $company->state ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Zip:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="zip" CLASS="input_text" SIZE="10" TYPE="text" VALUE="<?= $company->zip ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Phone:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="phone" CLASS="input_text" SIZE="25" TYPE="text" VALUE="<?= $company->phone ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Fax:</TD>
<TD CLASS="form_field_cell"><INPUT NAME="fax" CLASS="input_text" SIZE="25" TYPE="text" VALUE="<?= $company->fax ?>"></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Created On:</TD>
<TD CLASS="form_field_cell"><?= $company->created_ts ? date("D M jS, Y \a\\t h:i:s A", $company->created_ts) : "" ?></TD>
</TR>
<TR>
<TD CLASS="form_field_header_cell">Last Updated:</TD>
<TD CLASS="form_field_cell"><?= $company->updated_ts ? date("D M jS, Y \a\\t h:i:s A", $company->updated_ts) : "" ?></TD>
</TR>
<TR>
<TD COLSPAN="2" CLASS="form_field_cell">
<DIV ALIGN="right"><INPUT TYPE="submit" CLASS="button" NAME="save" VALUE="Save"></DIV>
</TD>
</TR>
</TABLE>
</FORM>
<? require('footer.php'); ?>