81 lines
2.5 KiB
PHP
81 lines
2.5 KiB
PHP
|
|
<?php
|
||
|
|
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
||
|
|
die ( 'Not A Valid Entry Point' );
|
||
|
|
|
||
|
|
global $sugar_version, $sugar_config, $current_user, $app_strings, $mod_strings;
|
||
|
|
|
||
|
|
require_once ('modules/EcmReturns/EcmReturn.php');
|
||
|
|
|
||
|
|
|
||
|
|
require_once ('include/time.php');
|
||
|
|
|
||
|
|
require_once ('include/json_config.php');
|
||
|
|
|
||
|
|
//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>';
|
||
|
|
|
||
|
|
$json_config = new json_config ();
|
||
|
|
|
||
|
|
$focus = new EcmReturn ();
|
||
|
|
|
||
|
|
if (isset ( $_REQUEST ['record'] )) {
|
||
|
|
$focus->retrieve ( $_REQUEST ['record'] );
|
||
|
|
$focus->format_all_fields ();
|
||
|
|
$OPT ['status'] = $focus->status;
|
||
|
|
}
|
||
|
|
|
||
|
|
require_once ('include/MVC/View/SugarView.php');
|
||
|
|
|
||
|
|
require_once ('modules/EcmReturns/views/DetailView/view.detail.my.php');
|
||
|
|
|
||
|
|
//create position list table
|
||
|
|
$pl = $focus->getPositionList();
|
||
|
|
|
||
|
|
$edit = new ViewDetailMy ();
|
||
|
|
$edit->ss = new Sugar_Smarty ();
|
||
|
|
$edit->module = 'EcmReturns';
|
||
|
|
|
||
|
|
|
||
|
|
$can_edit = false;
|
||
|
|
global $current_user;
|
||
|
|
if ($focus->assigned_user_id == $current_user->id || is_admin($current_user))
|
||
|
|
$can_edit = true;
|
||
|
|
$edit->ss->assign("CAN_EDIT", $can_edit);
|
||
|
|
|
||
|
|
$edit->ss->assign("CREATED_BY_NAME", $focus->created_by_name);
|
||
|
|
$edit->ss->assign("MODIFIED_BY_NAME", $focus->modified_by_name);
|
||
|
|
|
||
|
|
$edit->bean = $focus;
|
||
|
|
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
||
|
|
|
||
|
|
$edit->preDisplay ();
|
||
|
|
|
||
|
|
//check number
|
||
|
|
$db = $GLOBALS['db'];
|
||
|
|
|
||
|
|
$res = $db->query("SELECT id FROM ecmreturns WHERE document_no='$focus->document_no'");
|
||
|
|
if ($res->num_rows > 1) {
|
||
|
|
echo '<h1 style="color: red;">Błąd numeracji, skontaktuj się z administratorem! Nie drukuj/publikuj dokumentu!</h1>';
|
||
|
|
}
|
||
|
|
$can_mk = false;
|
||
|
|
$r = $db->fetchByAssoc($db->query("SELECT correct_id FROM ecmreturns WHERE id='".$focus->id."'"));
|
||
|
|
if($r['correct_id']==''){
|
||
|
|
$can_mk = true;
|
||
|
|
}
|
||
|
|
$edit->ss->assign("CREATE_CR", $can_mk);
|
||
|
|
|
||
|
|
echo $edit->display ();
|
||
|
|
|
||
|
|
require_once ('include/SubPanel/SubPanelTiles.php');
|
||
|
|
$subpanel = new SubPanelTiles ( $focus, 'EcmReturns' );
|
||
|
|
echo $subpanel->display ();
|
||
|
|
//loading view
|
||
|
|
echo '<link rel="stylesheet" type="text/css" href="modules/EcmReturns/javascript/helper.css" media="screen" /><div class="loading_panel"></div>';
|
||
|
|
?>
|