Example #1
0
File: Save.php Project: pohly/mts
 public function __construct()
 {
     $this->updatesDiv = $this->decodePost($_POST['data']);
     $this->savetype = $this->decodePost($_POST['savetype']);
     $this->deletedIndex = explode("|||||", $this->decodePost($_POST['deletedTiddlers']));
     $this->isPartial = $this->savetype == "partial";
     $this->updatesMap = createTiddlerMap($this->updatesDiv);
     $this->updatesIndex = array_keys($this->updatesMap);
     parent::__construct();
 }
$xtpl->assign('encoded_contact_popup_request_data', $encoded_contact_popup_request_data);
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'calculant_id', 'user_name' => 'calculant_name'));
$xtpl->assign('encoded_calculant_popup_request_data', $json->encode($popup_request_data));
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'contact_id', 'name' => 'contact_name'));
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
$xtpl->assign('encoded_contact_popup_request_data', $encoded_contact_popup_request_data);
$popup_request_data = array('call_back_function' => 'set_return_product', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'product_id', 'name' => 'product_name', 'account_id' => 'account_id', 'account_name' => 'account_name', 'contact_id' => 'contact_id', 'contact_name' => 'contact_name', 'number' => 'number'));
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
$xtpl->assign('encoded_products_popup_request_data', $encoded_contact_popup_request_data);
///
/// Assign the template variables
///
if (isset($_REQUEST['product_id']) && !empty($_REQUEST['product_id'])) {
    $product = new Products();
    $product->retrieve($_REQUEST['product_id']);
    $ClientRequest = new ClientRequest();
    $ClientRequest->retrieve($product->clientrequest_id);
    if (isset($ClientRequest->product_id) && !empty($ClientRequest->product_id)) {
        $focus->product_id = $ClientRequest->product_id;
        $focus->name = $ClientRequest->name;
        $focus->number = 'PTR' . $focus->generate_number('number', $focus->table_name);
        $focus->clientrequest_id = $ClientRequest->id;
        $focus->deadline = $ClientRequest->due_date;
        $focus->quantity = $ClientRequest->quantity;
        //TO DO: add sub_status
        //$focus->status = $ClientRequest->status;
        $focus->period = $ClientRequest->periodic;
        $focus->samples = $ClientRequest->samples;
        $focus->file = $ClientRequest->files;
        $focus->note = $ClientRequest->special_requirements;
        $focus->description = $ClientRequest->description;
            $EstimateComponents->date_entered = null;
            $EstimateComponents->date_modified = null;
            $EstimateComponents->created_by = null;
            $EstimateComponents->modified_user_id = null;
            $EstimateComponents->assigned_user_id = null;
            $EstimateComponents->assigned_user_name = null;
            $EstimateComponents->parent_bean = 'ClientOrders';
            $EstimateComponents->parent_id = $focus->id;
            $EstimateComponents->parent_name = $focus->name;
            $EstimateComponents->number = $EstimateComponents->generate_number('number', 'estimate_components', $focus->id, $focus->table_name);
            $EstimateComponents->save($GLOBALS['check_notify']);
        }
    }
} else {
    if (!is_null($focus->clientrequest_id) && !empty($focus->clientrequest_id)) {
        $ClientRequest = new ClientRequest();
        $ClientRequest->retrieve($focus->clientrequest_id);
        $xtpl->assign("clientrequest_id", $ClientRequest->id);
        $xtpl->assign("clientrequest_name", $ClientRequest->name);
        $xtpl->assign('clientrequest_number', $ClientRequest->number);
        $xtpl->assign('clientrequest_assigned_user_name', $ClientRequest->assigned_user_name);
        $xtpl->assign('clientrequest_due_date', $ClientRequest->due_date);
        $xtpl->parse('main.client_request_info');
    }
    if (!is_null($focus->quote_id) && !empty($focus->quote_id)) {
        $Quote = new Quote();
        $Quote->retrieve($focus->quote_id);
        $xtpl->assign("quote_id", $Quote->id);
        $xtpl->assign("quote_name", $Quote->name);
        $xtpl->assign('quote_number', $Quote->quotenum);
        $xtpl->assign('quote_account_name', $Quote->account_name);
 function get_client_request($product_id)
 {
     $clientrequest = new ClientRequest();
     $query = 'SELECT id FROM ' . $clientrequest->table_name . ' where product_id="' . $product_id . '" AND deleted=0';
     $result = $this->db->query($query, true, "");
     $data = $this->db->fetchByAssoc($result);
     //var_dump($query);
     if ($data != null) {
         $clientrequest->retrieve($data['id']);
         if ($clientrequest->id != null) {
             return $clientrequest;
         }
     } else {
         return null;
     }
 }
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'modules/Estimates/Estimates.php';
require_once 'modules/EstimateComponents/EstimateComponents.php';
require_once 'modules/ClientRequest/ClientRequest.php';
require_once 'modules/ProductStatus/ProductStatus.php';
require_once 'include/formbase.php';
$Estimates = new Estimates();
if (isset($_REQUEST['clientrequest_id']) && !empty($_REQUEST['clientrequest_id'])) {
    $ClientRequest = new ClientRequest();
    $ClientRequest->retrieve($_REQUEST['clientrequest_id']);
    $Estimates->product_id = $ClientRequest->product_id;
    $Estimates->name = $ClientRequest->name;
    $Estimates->number = 'PTR' . $Estimates->generate_number('number', $Estimates->table_name);
    $Estimates->clientrequest_id = $ClientRequest->id;
    $Estimates->deadline = $ClientRequest->due_date;
    $Estimates->quantity = $ClientRequest->quantity;
    $Estimates->status = $ClientRequest->status;
    $Estimates->period = $ClientRequest->periodic;
    $Estimates->samples = $ClientRequest->samples;
    $Estimates->file = $ClientRequest->files;
    $Estimates->note = $ClientRequest->special_requirements;
    $Estimates->description = $ClientRequest->description;
    $Estimates->operation_description = $ClientRequest->operation_description;
    //To Do: add operations
<?php

//check access
if (!defined('ROOT_ACCESS')) {
    echo "Access denies!";
    exit;
}
$ClientRequest = new ClientRequest();
$ClientRequest->Autorun();
//echo "<pre>";print_r($CMS->input);
class ClientRequest
{
    public function __construct()
    {
        return true;
    }
    public function Autorun()
    {
        global $CMS, $DB;
        $CMS->input = $this->AnalyticRequest();
        return true;
    }
    public function AnalyticRequest()
    {
        global $CMS, $DB;
        $split_url = explode("?", $_SERVER['REQUEST_URI']);
        if ($split_url[1]) {
            $tmp = explode("&", $split_url[1]);
            $split = array();
            foreach ($tmp as $arr) {
                $tmp1 = explode("=", $arr);
 function get_status($id = null)
 {
     if (!is_null($id)) {
         $clientrequest = new ClientRequest();
         $clientrequest->retrieve($id);
         $product = new Products();
         $product->retrieve($clientrequest->product_id);
         if (!is_null($product->status)) {
             //var_dump($clientrequest);
             //var_dump($product->id);
             return $product->status;
         }
     }
     return 'new_client_request';
 }
 function get_client_request($clientrequest_id)
 {
     if ($clientrequest_id != null) {
         $clientrequest = new ClientRequest();
         $clientrequest->retrieve($clientrequest_id);
         if ($clientrequest->id != null) {
             return $clientrequest;
         }
     } else {
         return null;
     }
 }
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'XTemplate/xtpl.php';
require_once 'data/Tracker.php';
require_once 'modules/ClientRequest/ClientRequest.php';
require_once 'include/time.php';
require_once 'modules/ClientRequest/Forms.php';
global $timedate;
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $sugar_version, $sugar_config;
$focus = new ClientRequest();
if (!empty($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("ClientRequest detail view");
$xtpl = new XTemplate('modules/ClientRequest/EditView.html');
/// Users Popup
$json = getJSONobj();
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
 * License.
 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'modules/ClientRequest/ClientRequest.php';
$sugarbean = new ClientRequest();
// perform the delete if given a record to delete
if (empty($_REQUEST['record'])) {
    $GLOBALS['log']->info('delete called without a record id specified');
} else {
    $record = $_REQUEST['record'];
    $sugarbean->retrieve($record);
    if (!$sugarbean->ACLAccess('Delete')) {
        ACLController::displayNoAccess(true);
        sugar_cleanup(true);
    }
    $GLOBALS['log']->info("deleting record: {$record}");
    $sugarbean->mark_deleted($record);
}
// handle the return location variables
$return_module = empty($_REQUEST['return_module']) ? 'ClientRequest' : $_REQUEST['return_module'];
Example #11
0
 /**
  * @covers aRvi\ClientRequest\ClientRequest::toArray
  * @todo   Implement testToArray().
  */
 public function testToArray()
 {
     $this->object->test = "test";
     $this->assertEquals("test", $this->object->toArray()['test']);
 }