Location: PHPKode > projects > Phpgw Time Tracking Add On App > timetrack/editcustomer.php
<?php
  /**************************************************************************\
  * phpgwtimetrack - phpGroupWare addon application                          *
  * http://phpgwtimetrack.sourceforge.net                                    *
  * Written by Robert Schader <hide@address.com>                         *
  * Written by Joseph Engo <hide@address.com>                          *
  * --------------------------------------------                             *
  *  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.                                              *
  \**************************************************************************/

  /* $Id: editcustomer.php,v 1.5 2001/01/12 22:14:35 rschader Exp $ */

 if($submit) {
  $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True);
 }

  $phpgw_info["flags"]["enable_nextmatchs_class"] = "True";
  $phpgw_info["flags"]["currentapp"] = "timetrack";

  include("../header.inc.php");

if($submit)
 {
  if($cust_active == "True") {
   // Set active flag to Y
   $active = "Y";
  } else {
   $active = "N";
  }

  $sql = "UPDATE customers SET website='" . addslashes($website)
	. "', ftpsite='"	. addslashes($ftpsite)
	. "', industry_type='"	. addslashes($industry_type)
	. "', status='"		. addslashes($status)
	. "', software='"	. addslashes($software)
	. "', lastjobnum='"	. addslashes($lastjobnum)
	. "', lastjobfinished='" . addslashes($lastjobfinished)
	. "', busrelationship='" . addslashes($busrelationship)
	. "', notes='"		. addslashes($notes)
	. "', active='"		. $active
	. "' WHERE company_id=" . $cid;

  $phpgw->db->query($sql);
  echo '<script LANGUAGE="JavaScript">';
  echo 'window.location="' . $phpgw->link("customers.php") . '"';
  echo '</script>';
 }
else
 {
  if (! $cid)
     Header("Location: " . $phpgw->link("customers.php")); 

  $phpgw->db->query("select * from customers where company_id='$cid'");
  $phpgw->db->next_record();
  $company_id = $phpgw->db->f("company_id");
  $company_name = $phpgw->db->f("company_name");
  $website = $phpgw->db->f("website");
  $ftpsite = $phpgw->db->f("ftpsite");
  $industry_type = $phpgw->db->f("industry_type");
  $status = $phpgw->db->f("status");
  $software = $phpgw->db->f("software");
  $lastjobnum = $phpgw->db->f("lastjobnum");
  $lastjobfinished = $phpgw->db->f("lastjobfinished");
  $busrelationship = $phpgw->db->f("busrelationship");
  $notes = $phpgw->db->f("notes");
  $cust_active = $phpgw->db->f("active");
  ?>

   <center>
   <form method="POST" name="editcust" action="<?php echo $phpgw->link();?>">
   <p><table border=0 width=50%>

    <input type="hidden" name="cid" value="<?php echo $cid;?>">

    <tr>
     <th colspan="2" align="center"><?php echo $company_name; ?></th>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Web Site"); ?></td>
     <td width="60%"><input name="website" value="<?php echo $website; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("FTP Site"); ?></td>
     <td width="60%"><input name="ftpsite" value="<?php echo $ftpsite; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Industry Type"); ?></td>
     <td width="60%"><input name="industry_type" value="<?php echo $industry_type; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Status"); ?></td>
     <td width="60%"><input name="status" value="<?php echo $status; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Software"); ?></td>
     <td width="60%"><input name="software" value="<?php echo $software; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Last Job"); ?></td>
     <td width="60%"><input name="lastjobnum" value="<?php echo $lastjobnum; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Date Finished"); ?></td>
     <td width="60%"><input name="lastjobfinished" value="<?php echo $lastjobfinished; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Relationship"); ?></td>
     <td width="60%"><input name="busrelationship" value="<?php echo $busrelationship; ?>"></td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Active Jobs"); ?></td>
     <td width="60%"><input type="checkbox" name="cust_active" value="True"
       <?php
          if($cust_active == "Y") echo " CHECKED";
           echo "></td>";
       ?>
     </td>
    </tr>

    <tr>
     <td width="40%"><?php echo lang("Notes"); ?></td>
     <td width="60%"><textarea  name="notes" cols="40" rows="4"
        wrap="virtual"><?php echo $notes; ?></textarea></td>
    </tr>

    <tr>
     <td colspan="2">&nbsp;</td>
    </tr>

    <tr>
      <td colspan=2>
      <input type="submit" name="submit" value="<?php echo lang("update"); ?>">
      </td>
    </tr>

    </table>
   </form>
   </center>

<?php
  $phpgw->common->phpgw_footer();
 }
?>
Return current item: Phpgw Time Tracking Add On App