<?php
/*
project related functions
(c) 2004-2007 by "Oleg Savchuk" <hide@address.com>
part of phpProjectMaster project
http://phpprojmaster.sourceforge.net
The contents of this file are subject to the GNU GENERAL PUBLIC LICENSE
http://www.gnu.org/copyleft/gpl.html
*/
require_once "sitelib.php";
require_once "form_utils.php";
require_once "upload_utils.php";
//preset module variables
$project_vars=array(
'table_name' => 'project',
'table_key_id' => 'p_id',
);
//get item fields from database
function get_project($item_id){
global $project_vars;
$sql="select * from $project_vars[table_name] where $project_vars[table_key_id]=$item_id";
return db_row($sql);
}
//get item fields from database
function get_project_name($item_id){
$hP=get_project($item_id);
return $hP['iname'];
}
//mark item as removed
function delete_project($item_id){
global $project_vars;
db_query("update $project_vars[table_name] set status=127 where $project_vars[table_key_id]=$item_id");
}
//******************* insert related record
function insert_customer($iname){
$item_id=db_value("select c_id from customer where iname=".dbq($iname)." and status=0");
if (!$item_id){
db_query("insert into customer (iname, add_time, add_u_id) VALUES (".dbq($iname).", now(), ".($_SESSION['u_id']+0).")");
$item_id=get_identity();
}
return $item_id;
}
?>