- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / modules / weberp / CustEDISetup.php
blobae5b9cb20080fcc63b2eea495e595652196e5c3e
1 <?php
2 /* $Revision: 1.8 $ */
4 $PageSecurity = 11;
6 include('includes/session.inc');
7 $title = _('Customer EDI Set Up');
8 include('includes/header.inc');
10 echo "<A HREF='" . $rootpath . '/SelectCustomer.php?' . SID . "'>" . _('Back to Customers') . '</A><BR>';
12 if (isset($_POST['submit'])) {
14 //initialise no input errors assumed initially before we test
15 $InputError = 0;
17 /* actions to take once the user has clicked the submit button
18 ie the page has called itself with some user input */
20 //first off validate inputs sensible
22 if (strstr($_POST['EDIReference'],"'")
23 OR strstr($_POST['EDIReference'],'+')
24 OR strstr($_POST['EDIReference'],"\"")
25 OR strstr($_POST['EDIReference'],'&')
26 OR strstr($_POST['EDIReference'],' ')) {
27 $InputError = 1;
28 prnMsg(_('The customers EDI reference code cannot contain any of the following characters') .' - \' & + \" ' . _('or a space'),'warn');
30 if (strlen($_POST['EDIReference'])<4 AND ($_POST['EDIInvoices']==1 OR $_POST['EDIOrders']==1)){
31 $InputError = 1;
32 prnMsg(_('The customers EDI reference code must be set when EDI Invoices or EDI orders are activated'),'warn');
34 if (strlen($_POST['EDIAddress'])<4 AND $_POST['EDIInvoices']==1){
35 $InputError = 1;
36 prnMsg(_('The customers EDI email address or FTP server address must be entered if EDI Invoices are to be sent'),'warn');
40 If ($InputError==0){ //ie no input errors
42 if (!isset($_POST['EDIServerUser'])){
43 $_POST['EDIServerUser']='';
45 if (!isset($_POST['EDIServerPwd'])){
46 $_POST['EDIServerPwd']='';
48 $sql = 'UPDATE debtorsmaster SET ediinvoices =' . $_POST['EDIInvoices'] . ',
49 ediorders =' . $_POST['EDIOrders'] . ",
50 edireference='" . $_POST['EDIReference'] . "',
51 editransport='" . $_POST['EDITransport'] . "',
52 ediaddress='" . $_POST['EDIAddress'] . "',
53 ediserveruser='" . $_POST['EDIServerUser'] . "',
54 ediserverpwd='" . $_POST['EDIServerPwd'] . "'
55 WHERE debtorno = '" . $_SESSION['CustomerID'] . "'";
57 $ErrMsg = _('The customer EDI setup data could not be updated because');
58 $result = DB_query($sql,$db,$ErrMsg);
59 prnMsg(_('Customer EDI configuration updated'),'success');
61 } else {
62 prnMsg(_('Customer EDI configuration failed'),'error');
66 echo "<FORM METHOD='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID ."'>";
67 echo '<CENTER><TABLE>';
69 $sql = "SELECT debtorno,
70 name,
71 ediinvoices,
72 ediorders,
73 edireference,
74 editransport,
75 ediaddress,
76 ediserveruser,
77 ediserverpwd
78 FROM debtorsmaster
79 WHERE debtorno = '" . $_SESSION['CustomerID'] . "'";
81 $ErrMsg = _('The customer EDI configuration details could not be retrieved because');
82 $result = DB_query($sql, $db,$ErrMsg);
84 $myrow = DB_fetch_array($result);
86 echo '<TR><TD>'._('Customer Code').':</TD>
87 <TD>' . $_SESSION['CustomerID'] . '</TD></TR>';
88 echo '<TR><TD>'._('Customer Name').':</TD>
89 <TD>' . $myrow['name'] . '</TD></TR>';
90 echo '<TR><TD>'._('Enable Sending of EDI Invoices').':</TD>
91 <TD><SELECT name="EDIInvoices">';
93 if ($myrow['ediinvoices']==0){
95 echo '<OPTION SELECTED VALUE=0>'._('Disabled');
96 echo '<OPTION VALUE=1>'._('Enabled');
97 } else {
98 echo '<OPTION VALUE=0>'._('Disabled');
99 echo '<OPTION SELECTED VALUE=1>'._('Enabled');
102 echo "</SELECT><A HREF='$rootpath/EDIMessageFormat.php?" . SID . "&MessageType=INVOIC&PartnerCode=" . $_SESSION['CustomerID'] . "'>"._('Create') . '/' . _('Edit Invoice Message Format').'</A></TD></TR>';
104 echo '<TR><TD>'._('Enable Receiving of EDI Orders').":</TD>
105 <TD><SELECT name='EDIOrders'>";
107 if ($myrow['ediorders']==0){
109 echo '<OPTION SELECTED VALUE=0>'._('Disabled');
110 echo '<OPTION VALUE=1>'._('Enabled');
111 } else {
112 echo '<OPTION VALUE=0>'._('Disabled');
113 echo '<OPTION SELECTED VALUE=1>'._('Enabled');
116 echo '</SELECT></TD></TR>';
118 echo '<TR><TD>'._('Customer EDI Reference').":</TD>
119 <TD><input type='Text' name='EDIReference' SIZE=20 MAXLENGTH=20 value='" . $myrow['edireference'] . "'></TD></TR>";
121 echo '<TR><TD>'._('EDI Communication Method').":</TD>
122 <TD><SELECT name='EDITransport'>";
124 if ($myrow['editransport']=='email'){
125 echo "<OPTION SELECTED VALUE='email'>"._('Email Attachments');
126 echo "<OPTION VALUE='ftp'>"._('File Transfer Protocol (FTP)');
127 } else {
128 echo "<OPTION VALUE='email'>"._('Email Attachments');
129 echo "<OPTION SELECTED VALUE='ftp'>"._('File Transfer Protocol (FTP)');
132 echo '</SELECT></TD></TR>';
134 echo '<TR><TD>'._('FTP Server or Email Address').":</TD>
135 <TD><input type='Text' name='EDIAddress' SIZE=42 MAXLENGTH=40 value='" . $myrow['ediaddress'] . "'></TD></TR>";
137 if ($myrow['editransport']=='ftp'){
139 echo '<TR><TD>'._('FTP Server User Name').":</TD>
140 <TD><input type='Text' name='EDIServerUser' SIZE=20 MAXLENGTH=20 value=" . $myrow['ediserveruser'] . "></TD></TR>";
141 echo '<TR><TD>'._('FTP Server Password').":</TD>
142 <TD><input type='Text' name='EDIServerPwd' SIZE=20 MAXLENGTH=20 value='" . $myrow['serverpwd'] . "'></TD></TR>";
145 echo "</TABLE><CENTER><input type='Submit' name='submit' value='"._('Update EDI Configuration')."'></FORM>";
147 include('includes/footer.inc');