Esempio n. 1
0
function insert_new_workorder($db, $VAR)
{
    global $smarty;
    //Remove Extra Slashes caused by Magic Quotes
    $work_order_description_string = $VAR['work_order_description'];
    $work_order_description_string = stripslashes($work_order_description_string);
    $work_order_comments_string = $VAR['work_order_comments'];
    $work_order_comments_string = stripslashes($work_order_comments_string);
    $sql = "INSERT INTO " . PRFX . "TABLE_WORK_ORDER  SET \n\t\t\tCUSTOMER_ID\t\t\t=" . $db->qstr($VAR["customer_ID"]) . ",\n\t\t\tWORK_ORDER_OPEN_DATE\t\t=" . $db->qstr(time()) . ",\n\t\t\tWORK_ORDER_STATUS\t\t=" . $db->qstr(10) . ",\n\t\t\tWORK_ORDER_CURRENT_STATUS\t=" . $db->qstr(1) . ",\n\t\t\tWORK_ORDER_CREATE_BY\t\t=" . $db->qstr($VAR["created_by"]) . ",\n\t\t\tWORK_ORDER_SCOPE\t\t=" . $db->qstr($VAR["scope"]) . ",\n\t\t\tWORK_ORDER_DESCRIPTION\t\t=" . $db->qstr($work_order_description_string) . ",\n\t\t\tLAST_ACTIVE\t\t\t=" . $db->qstr(time()) . ",\n\t\t\tWORK_ORDER_COMMENT\t\t=" . $db->qstr($work_order_comments_string);
    if (!($result = $db->Execute($sql))) {
        force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
        exit;
    }
    $wo_id = $db->Insert_ID();
    $VAR['wo_id'] = $wo_id;
    $VAR['work_order_status_notes'] = "Work Order Created";
    insert_new_status($db, $VAR);
    insert_new_note($db, $VAR);
    if (!empty($VAR['SCHEDULE_notes'])) {
        insert_new_note($db, $VAR);
    }
    $smarty->assign('wo_id', $wo_id);
    $smarty->assign('customer_id', $customer_id);
    $smarty->display("workorder/new_results.tpl");
}
Esempio n. 2
0
<?php

####################################################
# IN 			#
#	 				#
#  				#
#  This program is distributed under the terms and 	#
#  conditions of the GPL										#
#  New Note														#
#  Version 0.0.1	Sat Nov 26 20:46:40 PST 2005		#
#																	#
####################################################
require_once "include.php";
if (empty($VAR['wo_id'])) {
    force_page('core', 'error&error_msg=No Work Order ID');
    exit;
}
if (isset($VAR['submit'])) {
    if (!insert_new_note($db, $VAR)) {
        force_page('core', 'error&error_msg=Falied to insert Work Order Note');
        exit;
    } else {
        force_page('workorder', 'view&wo_id=' . $VAR['wo_id'] . '&page_title=Work%20Order%20ID%20' . $VAR['wo_id']);
        exit;
    }
} else {
    $smarty->assign('wo_id', $VAR['wo_id']);
    $smarty->display('workorder' . SEP . 'new_note.tpl');
}