init
This commit is contained in:
117
modules/EcmSales/EditView.php
Normal file
117
modules/EcmSales/EditView.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
ini_set('display_errors',1);
|
||||
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||||
die ( 'NotAValidEntryPoint' );
|
||||
|
||||
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings, $current_user, $app_list_strings;
|
||||
require_once ('modules/EcmSales/EcmSale.php');
|
||||
require_once ('modules/EcmSales/readXML.php');
|
||||
require_once ('include/time.php');
|
||||
$db = $GLOBALS['db'];
|
||||
//add jquery
|
||||
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.css"/>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="include/jQuery/jquery-ui/themes/base/jquery-ui.css"/>';
|
||||
echo '<script type="text/javascript"
|
||||
src="include/jQuery/jquery-2.1.0.min.js"></script>';
|
||||
echo '<script type="text/javascript"
|
||||
src="include/jQuery/jquery-table/jquery.appendGrid-1.3.1.js"></script>';
|
||||
echo '<script type="text/javascript"
|
||||
src="include/jQuery/jquery-ui/ui/jquery-ui.js"></script>';
|
||||
|
||||
// $cq=$current_user->getPreference('confirm_quotes');
|
||||
|
||||
$new_number = false;
|
||||
$duplicate = false;
|
||||
$focus = new EcmSale ();
|
||||
|
||||
if (isset ( $_REQUEST ['record'] ) && $_REQUEST['isDuplicate']=="false" ) {
|
||||
$focus->retrieve ( $_REQUEST ['record'] );
|
||||
if (isset ( $focus->id ) && $focus->id != '') {
|
||||
$focus->format_all_fields ();
|
||||
}
|
||||
}
|
||||
else if ($_REQUEST['isDuplicate']=="true") {
|
||||
$new_number=true;
|
||||
$duplicate=true;
|
||||
//get data
|
||||
$focus->retrieve($_REQUEST['return_id']);
|
||||
$focus->id = null;
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->payment_date = date("d.m.Y", strtotime($Date.' + '.$focus->payment_date_days.' days'));
|
||||
$focus->delivery_date = null;
|
||||
$focus->send_date = null;
|
||||
$focus->assigned_user_name=$current_user->full_name;
|
||||
$focus->assigned_user_id=$current_user->id;
|
||||
$focus->status = 's10';
|
||||
}else if ($_REQUEST['ecmquote_id']) {
|
||||
$new_number=true;
|
||||
$ecmquote_id =$_REQUEST['ecmquote_id'];
|
||||
$ecmquote =true;
|
||||
$q= new EcmQuote();
|
||||
//get data
|
||||
$q->retrieve($_REQUEST['ecmquote_id']);
|
||||
$focus->parent_id=$q->parent_id;
|
||||
$focus->parent_name=$q->parent_name;
|
||||
$focus->register_date=date("d.m.Y");
|
||||
$focus->position_list= $q->getPositionList(true);
|
||||
|
||||
}else if ($_REQUEST['upload'] && $_REQUEST['file']) {
|
||||
$new_number=true;
|
||||
$reader=New readXML();
|
||||
// wczytaj plik
|
||||
//$file=$reader->UploadXMLFile();
|
||||
if($_REQUEST['file']!=''){
|
||||
// załaduj dane z pliku do readera
|
||||
$reader->loadXMLFile($_REQUEST['file']);
|
||||
// załaduj dane do klasy
|
||||
$reader->loader($focus);
|
||||
$focus->edi_file = $_REQUEST['file'];
|
||||
}
|
||||
unset($reader);
|
||||
}
|
||||
else {
|
||||
$new_number=true;
|
||||
//dates
|
||||
$focus->register_date = date("d.m.Y");
|
||||
$focus->delivery_date = date("d.m.Y");
|
||||
//$focus->send_date = date("d.m.Y");
|
||||
//for subpanels??
|
||||
if (isset ( $_REQUEST ['contact_id'] ) && $_REQUEST ['contact_id'] != '' && isset ( $_REQUEST ['contact_name'] ) && $_REQUEST ['contact_name'] != '') {
|
||||
$_REQUEST ['parent_type'] = 'Contacts';
|
||||
$_REQUEST ['parent_name'] = $_REQUEST ['contact_name'];
|
||||
$_REQUEST ['parent_id'] = $_REQUEST ['contact_id'];
|
||||
$OPT ['check_parent_id'] = false;
|
||||
}
|
||||
|
||||
if (isset ( $_REQUEST ['account_id'] ) && $_REQUEST ['account_id'] != '' && isset ( $_REQUEST ['account_name'] ) && $_REQUEST ['account_name'] != '') {
|
||||
$_REQUEST ['parent_type'] = 'Accounts';
|
||||
$_REQUEST ['parent_name'] = $_REQUEST ['account_name'];
|
||||
$_REQUEST ['parent_id'] = $_REQUEST ['account_id'];
|
||||
$OPT ['check_parent_id'] = false;
|
||||
}
|
||||
$focus->status = 's30';
|
||||
}
|
||||
$res = $db->query("SELECT id, name FROM ecmstocks WHERE deleted = '0' ORDER BY name");
|
||||
$stock = '<select id="stock" name="stock"><option value=""></option>';
|
||||
$stock_body = '';
|
||||
while ($row = $db->fetchByAssoc($res))
|
||||
$stock_body.='<option value="'.$row['id'].'">'.$row['name'].'</option>';
|
||||
$stock.=$stock_body.'</select><input id="stock_id" name="stock_id" type="hidden"/>';
|
||||
|
||||
require_once ('include/MVC/View/SugarView.php');
|
||||
require_once ('modules/EcmSales/views/EditView/view.edit.ecmsales.php');
|
||||
$edit = new ViewEditEcmSales ();
|
||||
$edit->ss = new Sugar_Smarty ();
|
||||
$edit->module = 'EcmSales';
|
||||
$edit->bean = $focus;
|
||||
$edit->tplFile = 'include/ECM/EcmViews/EditView/Tabs/EditView.tpl';
|
||||
$edit->preDisplay ();
|
||||
$edit->ss->assign ( "NEW_NUMBER", $new_number );
|
||||
$edit->ss->assign("STOCK", $stock);
|
||||
$edit->ss->assign ( "ECMQUOTE_ID", $ecmquote_id );
|
||||
$edit->ss->assign ( "ECMQUOTE", $ecmquote );
|
||||
$edit->ss->assign ( "EDI_FILE", $focus->edi_file);
|
||||
$edit->ss->assign("DUPLICATE", $duplicate);
|
||||
echo $edit->display ();
|
||||
//loading view
|
||||
echo '<link rel="stylesheet" type="text/css" href="modules/EcmSales/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
|
||||
Reference in New Issue
Block a user