'; echo ''; /* $this->bean->category_name = $app_list_strings['document_category_dom'][$this->bean->category_id]; $this->bean->subcategory_name = $app_list_strings['document_subcategory_dom'][$this->bean->subcategory_id]; if(isset($this->bean->status_id)) { $this->bean->status = $app_list_strings['document_status_dom'][$this->bean->status_id]; } $this->bean->related_doc_name = Document::get_document_name($this->bean->related_doc_id); $this->bean->related_doc_rev_number = DocumentRevision::get_document_revision_name($this->bean->related_doc_rev_id); $this->bean->save_file = basename($this->bean->file_url_noimage); */ $load_signed=false; if ((isset($_REQUEST['load_signed_id']) && !empty($_REQUEST['load_signed_id']))) { $load_signed=true; if (isset($_REQUEST['record'])) { $this->bean->related_doc_id=$_REQUEST['record']; } if (isset($_REQUEST['selected_revision_id'])) { $this->bean->related_doc_rev_id=$_REQUEST['selected_revision_id']; } $this->bean->id=null; $this->bean->document_name=null; $this->bean->filename=null; $this->bean->is_template=0; } //if if (!empty($this->bean->id)) { $this->ss->assign("FILE_OR_HIDDEN", "hidden"); if (!$this->ev->isDuplicate) { $this->ss->assign("DISABLED", "disabled"); } } else { global $timedate; $format = $timedate->get_cal_date_format(); $format = str_replace('%', '', $format); $this->bean->active_date = date($format); $this->bean->revision = 1; $this->ss->assign("FILE_OR_HIDDEN", "file"); } $ws = $this->bean->getParentList(); $ul = $this->bean->getUserList(); $vl = $this->bean->getVatList(true); //var_dump($_POST); $this->ss->assign('VAT_LIST', $vl); $this->ss->assign('USER_LIST', $ul); $this->ss->assign('PARENT_TYPE_LIST', $app_list_strings['parent_type_display2']); $popup_request_data = array( 'call_back_function' => 'document_set_return', 'form_name' => 'EditView', 'field_to_name_array' => array( 'id' => 'related_doc_id', 'document_name' => 'related_document_name', ), ); $json = getJSONobj(); $this->ss->assign('encoded_document_popup_request_data', $json->encode($popup_request_data)); //create from subpanel if($this->bean->id=='' && $_REQUEST['return_module']!=''){ if(substr($_REQUEST['return_module'],0,3)=='Ecm'){ $module=substr($_REQUEST['parent_type'],0,strlen($_REQUEST['return_module'])-1); $d=new $module; $d->retrieve($_REQUEST[strtolower(substr($_REQUEST['return_module'],0,strlen($_REQUEST['return_module'])-1)).'_id']); if($_REQUEST['return_module']=='EcmStockDocIns'){ $this->bean->document_date=date('d.m.Y'); if($d->name==''){ $this->bean->document_name='PZ '.$d->document_no; } else { $this->bean->document_name=''.$d->name; } $this->bean->value=$d->total_brutto; $this->bean->document_number=$this->bean->document_name; $vat_pos=array('23%'=>0, '22%'=>1, '8%'=>2, '7%'=>3, '0%'=>4, 'Zw'=>5); $vat_list=array( '23%'=> array('vat_value'=>'23%','vat_id'=>'23'), '22%'=> array('vat_value'=>'22%','vat_id'=>'22'), '8%'=> array('vat_value'=>'8%','vat_id'=>'8'), '7%'=> array('vat_value'=>'7%','vat_id'=>'7'), '0%'=> array('vat_value'=>'0%','vat_id'=>'0'), 'Zw'=> array('vat_value'=>'Zw','vat_id'=>'0') ); $vat_list_r=array(); $a=explode(',',$d->vats_summary); foreach ($a as $key){ $tmp=explode(':',$key); if($tmp[0]!=''){ $vat_list[$tmp[0]]['netto']=$d->total_netto; $vat_list[$tmp[0]]['vat']=$tmp[1]; } } foreach ( $vat_list as $key=>$val){ $vat_list_r[]=$vat_list[$key]; } $json = getJSONobj(); $this->ss->assign('VAT_LIST', $vat_list_r); } $ws='[{"id":"","document_id":"","parent_id":"'.$d->parent_id.'","date_entered":"2014-11-28", "parent_type":"Account","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($d->parent_name).'"},{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"","parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.$d->document_no.'"}]'; if($_REQUEST['return_module']=='EcmProducts'){ $ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"","parent_type":"'.$module.'","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($_REQUEST['ecmproduct_name']).'"}]'; } } else { $module=substr($_REQUEST['return_module'],0,strlen($_REQUEST['return_module'])-1); $d=new $module; $d->retrieve($_REQUEST[strtolower(substr($_REQUEST['return_module'],0,strlen($_REQUEST['return_module'])-1)).'_id']); $ws='[{"id":"","document_id":"","parent_id":"'.$d->id.'","date_entered":"2014-11-28", "parent_type":"Account","deleted":"0","date_modified":null,"parent_name":"'.htmlentities($d->name).'"}]'; } } $this->ss->assign('PARENT_LIST', $ws); //get related document name. if (!empty($this->bean->related_doc_id)) { $this->ss->assign("RELATED_DOCUMENT_NAME",Document::get_document_name($this->bean->related_doc_id)); $this->ss->assign("RELATED_DOCUMENT_ID",$this->bean->related_doc_id); if (!empty($this->bean->related_doc_rev_id)) { $this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(DocumentRevision::get_document_revisions($this->bean->related_doc_id), $this->bean->related_doc_rev_id)); } else { $this->ss->assign("RELATED_DOCUMENT_REVISION_OPTIONS", get_select_options_with_id(DocumentRevision::get_document_revisions($this->bean->related_doc_id), '')); } } else { $this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled"); } //set parent information in the form. if (isset($_REQUEST['parent_id'])) { $this->ss->assign("PARENT_ID",$_REQUEST['parent_id']); } //if if (isset($_REQUEST['parent_name'])) { $this->ss->assign("PARENT_NAME", $_REQUEST['parent_name']); if (!empty($_REQUEST['parent_type'])) { switch (strtolower($_REQUEST['parent_type'])) { case "contracts" : $this->ss->assign("LBL_PARENT_NAME",$mod_strings['LBL_CONTRACT_NAME']); break; //todo remove leads case. case "leads" : $this->ss->assign("LBL_PARENT_NAME",$mod_strings['LBL_CONTRACT_NAME']); break; } //switch } //if } //if if (isset($_REQUEST['parent_type'])) { $this->ss->assign("PARENT_TYPE",$_REQUEST['parent_type']); } if ($load_signed) { $this->ss->assign("RELATED_DOCUMENT_REVISION_DISABLED", "disabled"); $this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "hidden"); $this->ss->assign("LOAD_SIGNED_ID",$_REQUEST['load_signed_id']); } else { $this->ss->assign("RELATED_DOCUMENT_BUTTON_AVAILABILITY", "button"); } //if-else $pl3 = $this->bean->getPositionList3(); $this->ss->assign('POSITION_LIST3', $pl3); //opt $file = 'modules/EcmGroupSales/EcmGroupSale.php'; if(file_exists($file)) { $cc = array(); require_once($file); $cc = EcmGroupSale::loadSettings(); } $OPT = array(); $OPT['row_item_height'] = $cc['row_item_height']; $OPT['row_item_height_selected'] = $cc['row_item_height_selected']; $OPT['rows_on_item_list'] = $cc['rows_on_item_list']; $OPT['position_table_height'] = $OPT['row_item_height']*$OPT['rows_on_item_list']+40+$OPT['rows_on_item_list']*4; $OPT['quick_product_item_adding'] = $cc['quick_product_item_adding']; global $current_user; $tmp = $current_user->getPreference('num_grp_sep'); if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_number_grouping_seperator']; $OPT['sep_1000'] = $tmp; $tmp = $current_user->getPreference('dec_sep'); if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_decimal_seperator']; $OPT['dec_sep'] = $tmp; $tmp = $current_user->getPreference('default_currency_significant_digits'); if(!isset($tmp) || $tmp == '' || $tmp == NULL) $tmp = $sugar_config['default_currency_significant_digits']; $OPT['dec_len'] = $tmp; echo ' '; parent::display(); } /** * @see SugarView::_getModuleTitleParams() */ protected function _getModuleTitleParams() { $params = array(); $params[] = $this->_getModuleTitleListParam(); if(!empty($this->bean->id)){ $params[] = "".$this->bean->document_name.""; $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL']; }else{ $params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']; } return $params; } }