Beispiel #1
0
 /**
  * Display view.
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request) {
     $recordModel = SPPDFTemplates_Record_Model::getInstanceById($request->get('templateid'));
     $moduleModel = new SPPDFTemplates_Module_Model();
     
     if($request->get('isDuplicate') != NULL ) {
         $recordModel->toDuplicate();
     }
     
     $viewer = $this->getViewer($request);
     
     // SalesPlatform.ru begin Unifying method for EditView preparing 
     $recordModel = prepareEditView($recordModel, $_REQUEST, $viewer); 
     // SalesPlatform.ru end
     
     $viewer->assign('MODULE', $request->getModule());
     $viewer->assign('MODEL', $recordModel);
     $viewer->assign('MODULENAMES',$moduleModel->getModulesList());
     $viewer->assign('PAGE_ORIENTATIONS',$moduleModel->getPageOrientations());
     $viewer->view('EditPDFTemplate.tpl', $request->getModule());
 }
Beispiel #2
0
 /**
  * Display view.
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $recordModel = SPPDFTemplates_Record_Model::getInstanceById($request->get('templateid'));
     $moduleModel = new SPPDFTemplates_Module_Model();
     $pdfCompanies = array('All' => vtranslate('All'));
     foreach (Settings_Vtiger_CompanyDetails_Model::getCompanies() as $company) {
         $pdfCompanies[$company] = vtranslate($company, 'Settings:Vtiger');
     }
     if ($request->get('isDuplicate') != NULL) {
         $recordModel->toDuplicate();
     }
     $viewer = $this->getViewer($request);
     // SalesPlatform.ru begin Unifying method for EditView preparing
     $recordModel = prepareEditView($recordModel, $_REQUEST, $viewer);
     // SalesPlatform.ru end
     $viewer->assign('MODULE', $request->getModule());
     $viewer->assign('MODEL', $recordModel);
     $viewer->assign('MODULENAMES', $moduleModel->getModulesList());
     $viewer->assign('PAGE_ORIENTATIONS', $moduleModel->getPageOrientations());
     $viewer->assign('SP_PDF_COMPANIES', $pdfCompanies);
     $viewer->view('EditPDFTemplate.tpl', $request->getModule());
 }
Beispiel #3
0
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *
 ********************************************************************************/
include_once 'modules/Invoice/InvoicePDFController.php';
// SalesPlatform.ru begin Create SP pdf templates
global $currentModule, $root_directory;
//global $currentModule;
// SalesPlatform.ru end
// SalesPlatform.ru begin Create SP pdf templates
$controllerClassName = "SalesPlatform_" . $currentModule . "PDFController";
$pdfTemplates = new SPPDFTemplates_Module_Model();
$templateId = null;
$availableTemplates = $pdfTemplates->getModuleTemplates($currentModule);
foreach ($availableTemplates as $template) {
    if ($template->getName() == 'Счет') {
        $templateId = $template->getId();
        break;
    }
}
$controller = new $controllerClassName($currentModule, $templateId);
//$controller = new Vtiger_InvoicePDFController($currentModule);
// SalesPlatform.ru end
$controller->loadRecord(vtlib_purify($_REQUEST['record']));
$invoice_no = getModuleSequenceNumber($currentModule, vtlib_purify($_REQUEST['record']));
$translatedmodname = vtranslate($currentModule, $currentModule);
if (isset($_REQUEST['savemode']) && $_REQUEST['savemode'] == 'file') {
Beispiel #4
0
	/**
	 * Function to get the detail view links (links and widgets)
	 * @param <array> $linkParams - parameters which will be used to calicaulate the params
	 * @return <array> - array of link models in the format as below
	 *                   array('linktype'=>list of link models);
	 */
	public function getDetailViewLinks($linkParams) {
		$linkTypes = array('DETAILVIEWBASIC','DETAILVIEW');
		$moduleModel = $this->getModule();
		$recordModel = $this->getRecord();

		$moduleName = $moduleModel->getName();
		$recordId = $recordModel->getId();

		$detailViewLink = array();

		if(Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId)) {
			$detailViewLinks[] = array(
					'linktype' => 'DETAILVIEWBASIC',
					'linklabel' => 'LBL_EDIT',
					'linkurl' => $recordModel->getEditViewUrl(),
					'linkicon' => ''
			);

			foreach ($detailViewLinks as $detailViewLink) {
				$linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLink);
			}
		}

		$linkModelListDetails = Vtiger_Link_Model::getAllByType($moduleModel->getId(),$linkTypes,$linkParams);
		//Mark all detail view basic links as detail view links.
		//Since ui will be look ugly if you need many basic links
		$detailViewBasiclinks = $linkModelListDetails['DETAILVIEWBASIC'];
		unset($linkModelListDetails['DETAILVIEWBASIC']);

		if(Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
			$deletelinkModel = array(
					'linktype' => 'DETAILVIEW',
					'linklabel' => sprintf("%s %s", getTranslatedString('LBL_DELETE', $moduleName), vtranslate('SINGLE_'. $moduleName, $moduleName)),
					'linkurl' => 'javascript:Vtiger_Detail_Js.deleteRecord("'.$recordModel->getDeleteUrl().'")',
					'linkicon' => ''
			);
			$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($deletelinkModel);
		}

		if(Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId)) {
			$duplicateLinkModel = array(
						'linktype' => 'DETAILVIEWBASIC',
						'linklabel' => 'LBL_DUPLICATE',
						'linkurl' => $recordModel->getDuplicateRecordUrl(),
						'linkicon' => ''
				);
			$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($duplicateLinkModel);
		}

		if(!empty($detailViewBasiclinks)) {
			foreach($detailViewBasiclinks as $linkModel) {
				// Remove view history, needed in vtiger5 to see history but not in vtiger6
				if($linkModel->linklabel == 'View History') {
					continue;
				}
				$linkModelList['DETAILVIEW'][] = $linkModel;
			}
		}
                
                //SalesPlatform.ru begin -  add PDF templates links to DetailView  from SPPDFTemplates
                
                /* Two cycles - to order */
                $pdfTemplates = new SPPDFTemplates_Module_Model();
                $avalibleTemplates = $pdfTemplates->getModuleTemplates($this->getModuleName());
                
                foreach($avalibleTemplates as $template) {
                    
                   /* Export PDF links */
                   $pdfTemplateLink = array(
                        'linklabel' => sprintf("%s %s", vtranslate('LBL_EXPORT_TO_PDF',$moduleName), $template->getName()),
                        'linkurl' => $recordModel->getExportPDFURL($template),
                   );
                   $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($pdfTemplateLink);
                }
                
                foreach($avalibleTemplates as $template) {
                   
                   /* Email link */
                   $sendEmailLink = array(
                        'linklabel' => sprintf("%s %s", vtranslate('LBL_SEND_MAIL_PDF', $moduleName), $template->getName()),
                        'linkurl' => 'javascript:Vtiger_Detail_Js.sendEmailPDFClickHandler(\''
                                            .$recordModel->getSendEmailPDFUrl($template).'\')',
                   );
                   $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($sendEmailLink);
                } 
                //SalesPlatform.ru end

		$relatedLinks = $this->getDetailViewRelatedLinks();

		foreach($relatedLinks as $relatedLinkEntry) {
			$relatedLink = Vtiger_Link_Model::getInstanceFromValues($relatedLinkEntry);
			$linkModelList[$relatedLink->getType()][] = $relatedLink;
		}

		$widgets = $this->getWidgets();
		foreach($widgets as $widgetLinkModel) {
			$linkModelList['DETAILVIEWWIDGET'][] = $widgetLinkModel;
		}

		$currentUserModel = Users_Record_Model::getCurrentUserModel();
		if($currentUserModel->isAdminUser()) {
			$settingsLinks = $moduleModel->getSettingLinks();
			foreach($settingsLinks as $settingsLink) {
				$linkModelList['DETAILVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
			}
		}

		return $linkModelList;
	}