phpBMS

root/trunk/phpbms/modules/bms/clients_addedit.php

Revision 702, 12.7 KB (checked in by brieb, 2 years ago)

Updated copyrights to 2010

  • Property svn:keywords set to LastChangedBy LastChangedDate LastChangedRevision
Line 
1<?php
2/*
3 $Rev$ | $LastChangedBy$
4 $LastChangedDate$
5 +-------------------------------------------------------------------------+
6 | Copyright (c) 2004 - 2010, Kreotek LLC                                  |
7 | All rights reserved.                                                    |
8 +-------------------------------------------------------------------------+
9 |                                                                         |
10 | Redistribution and use in source and binary forms, with or without      |
11 | modification, are permitted provided that the following conditions are  |
12 | met:                                                                    |
13 |                                                                         |
14 | - Redistributions of source code must retain the above copyright        |
15 |   notice, this list of conditions and the following disclaimer.         |
16 |                                                                         |
17 | - Redistributions in binary form must reproduce the above copyright     |
18 |   notice, this list of conditions and the following disclaimer in the   |
19 |   documentation and/or other materials provided with the distribution.  |
20 |                                                                         |
21 | - Neither the name of Kreotek LLC nor the names of its contributore may |
22 |   be used to endorse or promote products derived from this software     |
23 |   without specific prior written permission.                            |
24 |                                                                         |
25 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS     |
26 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT       |
27 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
28 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      |
29 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,   |
30 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT        |
31 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,   |
32 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY   |
33 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT     |
34 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
35 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
36 |                                                                         |
37 +-------------------------------------------------------------------------+
38*/
39
40        include("../../include/session.php");
41        include("include/tables.php");
42        include("include/fields.php");
43        include("include/addresses.php");
44        include("include/addresstorecord.php");
45        include("include/clients.php");
46
47        if(!isset($_GET["backurl"]))
48                $backurl = NULL;
49        else{
50                $backurl = $_GET["backurl"];
51                if(isset($_GET["refid"]))
52                        $backurl .= "?refid=".$_GET["refid"];
53        }
54
55        $thetable = new clients($db,"tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083",$backurl);
56        $therecord = $thetable->processAddEditPage();
57
58        if(isset($therecord["phpbmsStatus"]))
59                $statusmessage = $therecord["phpbmsStatus"];
60
61        $pageTitle=ucwords($therecord["type"]);
62
63        if($therecord["inactive"])
64                $pageTitle="Inactive ".$pageTitle;
65
66
67        $phpbms->cssIncludes[] = "pages/client.css";
68        $phpbms->jsIncludes[] = "modules/bms/javascript/client.js";
69
70                //Form Elements
71                //==============================================================
72                $theform = new phpbmsForm();
73
74                $theinput = new inputCheckbox("inactive",$therecord["inactive"]);
75                $theform->addField($theinput);
76               
77               
78                if(moduleExists("mod:58c60122-9d08-af17-e95b-765d74c7c422", $phpbms->modules))
79                        $name = "subscribed to mailchimp";
80                $theinput = new inputCheckbox("canemail", $therecord["canemail"], "can email");
81                $theform->addField($theinput);
82
83                $theinput = new inputBasicList("type",$therecord["type"],array("prospect"=>"prospect","client"=>"client"), "type");
84                $theinput->setAttribute("class","important");
85                $theinput->setAttribute("onchange","changeClientType(this)");
86                $disabled=false;
87                if($therecord["type"]=="client" && $therecord["id"]){
88                        $disabled = $thetable->checkForInvoices($therecord["id"]);
89                        if($disabled)
90                                $theinput->setAttribute("disabled","disabled");
91                }//endif
92                $theform->addField($theinput);
93
94                $theinput = new inputChoiceList($db, "category",$therecord["category"],"clientcategories");
95                $theform->addField($theinput);
96
97                $theinput = new inputSmartSearch($db, "salesmanagerid", "Pick Active User", $therecord["salesmanagerid"], "sales person");
98                $theform->addField($theinput);
99
100                $theinput = new inputChoiceList($db, "leadsource",$therecord["leadsource"],"leadsource", "lead source");
101                $theinput->setAttribute("class","small");
102                $theform->addField($theinput);
103
104                $theinput = new inputField("firstname", $therecord["firstname"] , "first name", false, null, 30, 64);
105                $theinput->setAttribute("class","important");
106                $theform->addField($theinput);
107
108                $theinput = new inputField("lastname", $therecord["lastname"] , "last name", false, null, 30, 64);
109                $theinput->setAttribute("class","important");
110                $theform->addField($theinput);
111
112                $theinput = new inputField("company", $therecord["company"], null, false, null, 64, 128);
113                $theinput->setAttribute("class","important");
114                $theform->addField($theinput);
115
116                $theinput = new inputDataTableList($db, "paymentmethodid",$therecord["paymentmethodid"],"paymentmethods","uuid","name",
117                                                                "inactive=0", "priority,name", true, "payment method", true, "");
118                $theform->addField($theinput);
119
120                $theinput = new inputDataTableList($db, "shippingmethodid",$therecord["shippingmethodid"],"shippingmethods","uuid","name",
121                                                                "inactive=0", "priority,name", true, "shipping method", true, "");
122                $theform->addField($theinput);
123
124                $theinput = new inputDataTableList($db, "discountid",$therecord["discountid"],"discounts","uuid","name",
125                                                                "inactive=0", "name", true, "discount", true, "");
126                $theform->addField($theinput);
127
128                $theinput = new inputDataTableList($db, "taxareaid",$therecord["taxareaid"],"tax","uuid","name",
129                                                                "inactive=0", "name", true, "tax area", true, "");
130                $theform->addField($theinput);
131
132                $theinput = new inputField("workphone",$therecord["workphone"],"work phone",false,"phone",25,32);
133                $theform->addField($theinput);
134
135                $theinput = new inputField("homephone",$therecord["homephone"],"home phone",false,"phone",25,32);
136                $theform->addField($theinput);
137
138                $theinput = new inputField("mobilephone",$therecord["mobilephone"],"mobile phone",false,"phone",25,32);
139                $theform->addField($theinput);
140
141                $theinput = new inputField("fax",$therecord["fax"],NULL,false,"phone",25,32);
142                $theform->addField($theinput);
143
144                $theinput = new inputField("otherphone",$therecord["otherphone"],"other phone",false,"phone",25,32);
145                $theform->addField($theinput);
146
147                $theinput = new inputField("email",$therecord["email"],NULL,false,"email",68,128);
148                $theform->addField($theinput);
149
150                $theinput = new inputField("webaddress",$therecord["webaddress"],"web address",false,"www",68,128);
151                $theform->addField($theinput);
152
153                $theinput = new inputField("taxid", $therecord["taxid"], "tax id", false, "", 25, 32);
154                $theform->addField($theinput);
155
156                $thetable->getCustomFieldInfo();
157                $theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord);
158                $theform->jsMerge();
159                //==============================================================
160                //End Form Elements
161
162        include("header.php");
163
164        $action = htmlQuotes($_SERVER["REQUEST_URI"]);
165        if(isset($_GET["invoiceid"]))
166                $action .= "&amp;invoiceid=".$_GET["invoiceid"];
167?>
168<form action="<?php echo $action; ?>" method="post" name="record" onsubmit="return validateForm(this);"><div id="dontSubmit"><input type="submit" value=" " onclick="return false;" /></div>
169<?php $phpbms->showTabs("clients entry", "tab:becfca94-ae25-a42c-7909-247d5324e4b5", $therecord["id"]); ?>
170<div class="bodyline">
171        <div id="topButtons">
172                <?php showSaveCancel(1); ?>
173        </div>
174
175        <h1 id="h1Title"><span><?php echo $pageTitle ?></span></h1>
176
177        <div id="rightSideDiv">
178                <?php if(isset($_GET["invoiceid"])){?>
179                <p id="backtoorderP">
180                        <input name="gotoinvoice" id="gotoinvoice" type="button" value="return to order" onclick="location.href='<?php echo getAddEditFile($db, "tbld:62fe599d-c18f-3674-9e54-b62c2d6b1883") ?>?id=<?php echo $_GET["invoiceid"] ?>'" class="Buttons" />
181                </p>
182                <?php } ?>
183                <fieldset>
184                        <legend>attributes</legend>
185
186                        <p><?php $theform->showField("type");?></p>
187
188                        <p><?php $theform->showField("inactive")?></p>
189
190                        <p id="becameclientDiv" <?php if($therecord["type"]=="prospect") echo "style=\"display:none;\"" ?>>
191                                <label for="becameclient">became a client</label><br />
192                                <input type="text" id="becameclient" name="becameclient" readonly="readonly" class="uneditable" value="<?php echo formatFromSQLDate($therecord["becameclient"])?>" size="8" />
193                                <input type="hidden" id="hascredit" name="hascredit" value="<?php echo $therecord["hascredit"]?>"/>
194                                <input type="hidden" id="creditlimit" name="creditlimit" value="<?php echo $therecord["creditlimit"]?>"/>
195                        </p>
196
197                        <p><?php $theform->showField("category")?></p>
198
199                </fieldset>
200
201                <fieldset>
202                        <legend>sales</legend>
203                        <div class="fauxP"><?php $theform->showField("salesmanagerid")?></div>
204
205                        <p><?php $theform->showField("leadsource")?></p>
206                </fieldset>
207
208                <fieldset>
209                        <legend>order defaults</legend>
210
211                        <p><?php $theform->showField("paymentmethodid")?></p>
212
213                        <p><?php $theform->showField("shippingmethodid")?></p>
214
215                        <p><?php $theform->showField("discountid")?></p>
216
217                        <p><?php $theform->showField("taxareaid")?></p>
218
219                </fieldset>
220
221                <fieldset>
222                        <legend>e-Commerce Login</legend>
223                        <p>
224                                <label for="username">user name</label><br />
225                                <input id="username" name="username" value="<?php echo htmlQuotes($therecord["username"])?>" maxlength="32" size="20"/>
226                        </p>
227                        <p>
228                                <label for="password">password</label><br />
229                                <input id="password" name="password" value="<?php echo htmlQuotes($therecord["password"])?>" maxlength="32" size="20"/>
230                        </p>
231
232                        <p><button class="Buttons" onclick="generateUserAndPass()" type="button">Generate</button></p>
233
234                        <p class="notes">Client user names and passwords are <strong>not</strong> used for clients' to log in directly to phpBMS.</p>
235                </fieldset>
236        </div>
237
238        <div id="leftSideDiv">
239                <fieldset>
240                        <legend>name</legend>
241                        <p class="big"><?php $theform->showField("company")?></p>
242
243                        <p id="firstnameP" class="big"><?php $theform->showField("firstname")?></p>
244
245                        <p class="big"><?php $theform->showField("lastname")?></p>
246
247                </fieldset>
248
249                <fieldset>
250                        <legend>contact</legend>
251
252                        <p class="phonelefts"><?php $theform->showField("workphone")?></p>
253
254                        <p><?php $theform->showField("homephone")?></p>
255
256                        <p class="phonelefts"><?php $theform->showField("mobilephone")?></p>
257
258                        <p><?php $theform->showField("fax")?></p>
259
260                        <p><?php $theform->showField("otherphone")?></p>
261
262                        <p><?php $theform->showField("email")?></p>
263                       
264                        <p><?php $theform->showField("canemail"); ?></p>
265
266                        <p><?php $theform->showField("webaddress")?></p>
267
268                        <p><?php $theform->showField("taxid")?></p>
269                </fieldset>
270
271                <fieldset>
272                        <legend>
273                                <label for="address1">primary address</label>
274                                <button type="button" class="graphicButtons buttonMap" id="buttonMap" title="show map"><span>map</span></button>
275                        </legend>
276
277                        <p>
278                                <input type="hidden" id="addressid" name="addressid" value="<?php echo $therecord["addressid"]?>"/>
279                                <input id="address1" name="address1" type="text" size="71" maxlength="128" value="<?php echo htmlQuotes($therecord["address1"])?>" /><br />
280                                <input id="address2" name="address2" type="text" size="71" maxlength="128" value="<?php echo htmlQuotes($therecord["address2"])?>" />
281                        </p>
282
283                        <p class="csz">
284                                <label for="city">city</label><br />
285                                <input name="city" type="text" id="city" value="<?php echo htmlQuotes($therecord["city"])?>" size="35" maxlength="64" />
286                        </p>
287
288                        <p class="csz">
289                                <label for="state">state/province</label><br />
290                                <input name="state" type="text" id="state" value="<?php echo htmlQuotes($therecord["state"])?>" size="10" maxlength="20" />
291                        </p>
292                        <p>
293                                <label for="postalcode">zip/postal code</label><br />
294                                <input name="postalcode" type="text" id="postalcode" value="<?php echo htmlQuotes($therecord["postalcode"])?>" size="12" maxlength="15" />
295                        </p>
296                        <p>
297                                <label for="country">country</label><br />
298                                <input id="country" name="country" type="text" value="<?php echo htmlQuotes($therecord["country"])?>" size="44" maxlength="128" />
299                        </p>
300
301                </fieldset>
302
303
304                <fieldset>
305                        <legend><label for="comments">memo</label></legend>
306                        <p>
307                        <textarea name="comments" cols="20" rows="10" id="comments"><?php echo $therecord["comments"]?></textarea>
308                        </p>
309                </fieldset>
310
311                <?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?>
312        </div><?php $theform->showGeneralInfo($phpbms,$therecord);?>
313        </div>
314</form>
315<?php include("footer.php")?>
Note: See TracBrowser for help on using the browser.
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.