first commit

This commit is contained in:
BACHIR SOULDI
2025-09-28 08:49:37 +01:00
commit 2794e62571
16819 changed files with 2664196 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
{*<!--
/*********************************************************************************
** 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.
*
********************************************************************************/
-->*}
{strip}
<div id="listPriceUpdateContainer">
<div class="modal-header">
<button data-dismiss="modal" class="pull-right"><i class="icon-remove alignMiddle"></i></button>
<h3>{vtranslate('LBL_EDIT_LIST_PRICE', $MODULE)}</h3>
</div>
<form class="form-horizontal" id="listPriceUpdate" method="post" action="index.php">
<input type="hidden" name="module" value="{$MODULE}" />
<input type="hidden" name="action" value="RelationAjax" />
<input type="hidden" name="src_record" value="{$PRICEBOOK_ID}" />
<input type="hidden" name="relid" value="{$REL_ID}" />
<div class="modal-body">
<div>
<span><strong>{vtranslate('LBL_EDIT_LIST_PRICE',$MODULE)}</strong></span>
&nbsp;:&nbsp;
<input type="text" name="currentPrice" value="{$CURRENT_PRICE}" data-validation-engine="validate[required,funcCall[Vtiger_Currency_Validator_Js.invokeValidation]]"
data-decimal-separator='{$USER_MODEL->get('currency_decimal_separator')}' data-group-separator='{$USER_MODEL->get('currency_grouping_separator')}' />
</div>
</div>
{include file='ModalFooter.tpl'|@vtemplate_path:$MODULE}
</form>
</div>
{/strip}

View File

@@ -0,0 +1,22 @@
{*<!--
/*********************************************************************************
** 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.
*
********************************************************************************/
-->*}
{strip}
<div id="popupPageContainer" class="contentsDiv">
<div class="paddingLeftRight10px">{include file='PopupSearch.tpl'|@vtemplate_path:$MODULE_NAME}
<form id="popupPage" action="javascript:void(0)">
<div id="popupContents">{include file='ProductPriceBookPopupContents.tpl'|@vtemplate_path:$PARENT_MODULE}</div>
</form>
</div>
<input type="hidden" class="triggerEventName" value="{getPurifiedSmartyParameters('triggerEventName')}"/>
</div>
</div>
{/strip}

View File

@@ -0,0 +1,83 @@
{*<!--
/*********************************************************************************
** 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.
*
********************************************************************************/
-->*}
{strip}
<div class="contents-topscroll">
<div class="topscroll-div">
&nbsp;
</div>
</div>
<div class="popupEntriesDiv relatedContents contents-bottomscroll">
<input type="hidden" value="{$ORDER_BY}" id="orderBy">
<input type="hidden" value="{$SORT_ORDER}" id="sortOrder">
<input type="hidden" value="{$SOURCE_FIELD}" id="sourceField">
<input type="hidden" value="{$SOURCE_RECORD}" id="sourceRecord">
<input type="hidden" value="{$SOURCE_MODULE}" id="parentModule">
<input type="hidden" value="Product_PriceBooks_Popup_Js" id="popUpClassName"/>
{assign var=WIDTHTYPE value=$USER_MODEL->get('rowheight')}
<div class="bottomscroll-div">
<table class="table table-bordered listViewEntriesTable">
<thead>
<tr class="listViewHeaders">
<th class="{$WIDTHTYPE}">
<input type="checkbox" class="selectAllInCurrentPage" />
</th>
{foreach item=LISTVIEW_HEADER from=$LISTVIEW_HEADERS}
<th class="{$WIDTHTYPE}">
<a class="listViewHeaderValues cursorPointer" data-nextsortorderval="{if $ORDER_BY eq $LISTVIEW_HEADER->get('column')}{$NEXT_SORT_ORDER}{else}ASC{/if}" data-columnname="{$LISTVIEW_HEADER->get('column')}">{vtranslate($LISTVIEW_HEADER->get('label'), $MODULE_NAME)}
{if $ORDER_BY eq $LISTVIEW_HEADER->get('column')}<img class="sortImage" src="{vimage_path( $SORT_IMAGE, $MODULE_NAME)}">{else}<img class="hide sortingImage" src="{vimage_path( 'downArrowSmall.png', $MODULE_NAME)}">{/if}</a>
</th>
{/foreach}
<th class="listViewHeaderValues noSorting {$WIDTHTYPE}">{vtranslate('LBL_UNIT_PRICE',$MODULE_NAME)}</th>
<th class="listViewHeaderValues noSorting {$WIDTHTYPE}">{vtranslate('LBL_LIST_PRICE',$MODULE_NAME)}</th>
</tr>
</thead>
{foreach item=LISTVIEW_ENTRY from=$LISTVIEW_ENTRIES name=popupListView}
<tr class="listViewEntries" data-id="{$LISTVIEW_ENTRY->getId()}" data-name='{$LISTVIEW_ENTRY->getName()}' data-currency='{$LISTVIEW_ENTRY->get('currency_id')}'
{if $GETURL neq '' } data-url='{$LISTVIEW_ENTRY->$GETURL()}' {/if} id="{$MODULE}_popUpListView_row_{$smarty.foreach.popupListView.index+1}">
<td class="{$WIDTHTYPE}">
<input class="entryCheckBox" type="checkbox" />
</td>
{foreach item=LISTVIEW_HEADER from=$LISTVIEW_HEADERS}
{assign var=LISTVIEW_HEADERNAME value=$LISTVIEW_HEADER->get('name')}
<td class="listViewEntryValue {$WIDTHTYPE}">
{if $LISTVIEW_HEADER->isNameField() eq true or $LISTVIEW_HEADER->get('uitype') eq '4'}
<a>{$LISTVIEW_ENTRY->get($LISTVIEW_HEADERNAME)}</a>
{else}
<a>{$LISTVIEW_ENTRY->get($LISTVIEW_HEADERNAME)}</a>
{/if}
</td>
{/foreach}
<td class="listViewEntryValue {$WIDTHTYPE}">
<a>{$LISTVIEW_ENTRY->get('unit_price')}</a>
</td>
<td class="listViewEntryValue {$WIDTHTYPE}">
<div class="row-fluid">
<input type="text" value="{$LISTVIEW_ENTRY->get('unit_price')}" name="listPrice" class="invisible span10 zeroPaddingAndMargin" data-validation-engine="validate[required,funcCall[Vtiger_Currency_Validator_Js.invokeValidation]]"
data-decimal-separator='{$USER_MODEL->get('currency_decimal_separator')}' data-group-separator='{$USER_MODEL->get('currency_grouping_separator')}'/>
</div>
</td>
</tr>
{/foreach}
</table>
</div>
<!--added this div for Temporarily -->
{if $LISTVIEW_ENTRIES_COUNT eq '0'}
<div class="row-fluid">
<div class="emptyRecordsDiv">{vtranslate('LBL_EQ_ZERO', $MODULE_NAME)} {vtranslate($MODULE_NAME, $MODULE_NAME)} {vtranslate('LBL_FOUND', $MODULE_NAME)}.</div>
</div>
{/if}
</div>
<div class="clearfix form-actions" style="border: 1px solid #DDDDDD;">
<a class="cancelLink pull-right">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a>
<button class="btn addButton select pull-right"><i class="icon-plus"></i>&nbsp;<strong>{vtranslate('LBL_ADD_TO',$MODULE_NAME)}&nbsp;{vtranslate($SOURCE_MODULE, $SOURCE_MODULE)}</strong></button>
</div>
{/strip}

View File

@@ -0,0 +1,127 @@
{*<!--
/*********************************************************************************
** 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.
*
********************************************************************************/
-->*}
{strip}
<div class="relatedContainer">
<input type="hidden" name="currentPageNum" value="{$PAGING->getCurrentPage()}" />
<input type="hidden" name="relatedModuleName" class="relatedModuleName" value="{$RELATED_MODULE->get('name')}" />
<input type="hidden" value="{$ORDER_BY}" id="orderBy">
<input type="hidden" value="{$SORT_ORDER}" id="sortOrder">
<input type="hidden" value="{$RELATED_ENTIRES_COUNT}" id="noOfEntries">
<input type='hidden' value="{$PAGING->getPageLimit()}" id='pageLimit'>
<input type='hidden' value="{$TOTAL_ENTRIES}" id='totalCount'>
<div class="relatedHeader ">
<div class="btn-toolbar row-fluid">
<div class="span6">
{foreach item=RELATED_LINK from=$RELATED_LIST_LINKS['LISTVIEWBASIC']}
<div class="btn-group">
{assign var=IS_SELECT_BUTTON value={$RELATED_LINK->get('_selectRelation')}}
<button type="button" class="btn
{if $IS_SELECT_BUTTON eq true} selectRelation {/if} "
{if $IS_SELECT_BUTTON eq true} data-moduleName={$RELATED_LINK->get('_module')->get('name')} {/if}
{if $RELATED_LINK->isPageLoadLink()}onclick="window.location.href='{$RELATED_LINK->getUrl()}'"{/if}
>{if $IS_SELECT_BUTTON eq false}<i class="icon-plus"></i>{/if}&nbsp;<strong>{$RELATED_LINK->getLabel()}</strong></button>
</div>
{/foreach}
&nbsp;
</div>
<div class="span6">
<div class="pull-right">
<div class="pageNumbers">
<span class="pageNumbersText">{if !empty($RELATED_RECORDS)} {$PAGING->getRecordStartRange()} {vtranslate('LBL_to', $RELATED_MODULE->get('name'))} {$PAGING->getRecordEndRange()}{else}<span>&nbsp;</span>{/if}</span>
<span class="icon-refresh pull-right totalNumberOfRecords cursorPointer{if empty($RELATED_RECORDS)} hide{/if}"></span>
</div>
<div class="span4">
<span class="btn-group pull-right">
<button class="btn" id="relatedListPreviousPageButton" {if !$PAGING->isPrevPageExists()} disabled="disabled" {/if} type="button"><span class="icon-chevron-left"></span></button>
<button class="btn dropdown-toggle" type="button" id="relatedListPageJump" data-toggle="dropdown" {if $PAGE_COUNT eq 1} disabled {/if}">
<i class="vtGlyph vticon-pageJump" title="{vtranslate('LBL_LISTVIEW_PAGE_JUMP',$moduleName)}"></i>
</button>
<ul class="listViewBasicAction dropdown-menu" id="relatedListPageJumpDropDown">
<li>
<span class="row-fluid">
<span class="span3"><span class="pull-right">{vtranslate('LBL_PAGE',$moduleName)}</span></span>
<span class="span4">
<input type="text" id="pageToJump" class="listViewPagingInput" value="{$PAGING->getCurrentPage()}"/>
</span>
<span class="span2 textAlignCenter">
{vtranslate('LBL_OF',$moduleName)}
</span>
<span class="span3" id="totalPageCount">{$PAGE_COUNT}</span>
</span>
</li>
</ul>
<button class="btn" id="relatedListNextPageButton" {if (!$PAGING->isNextPageExists()) or ($PAGE_COUNT eq 1)} disabled="disabled" {/if} type="button"><span class="icon-chevron-right"></span></button>
</span>
</div>
</div>
</span>
</div>
</div>
</div>
<div class="contents-topscroll">
<div class="topscroll-div">
&nbsp;
</div>
</div>
<div class="relatedContents contents-bottomscroll">
<div class="bottomscroll-div">
{assign var=WIDTHTYPE value=$USER_MODEL->get('rowheight')}
<table class="table table-bordered listViewEntriesTable">
<thead>
<tr class="listViewHeaders">
{foreach item=HEADER_FIELD from=$RELATED_HEADERS}
<th nowrap {if $HEADER_FIELD@last} colspan="2" {/if}>
<a href="javascript:void(0);" class="relatedListHeaderValues" data-nextsortorderval="{if $COLUMN_NAME eq $HEADER_FIELD->get('name')}{$NEXT_SORT_ORDER}{else}ASC{/if}" data-fieldname="{$HEADER_FIELD->get('name')}">{vtranslate($HEADER_FIELD->get('label'), $RELATED_MODULE->get('name'))}
&nbsp;&nbsp;{if $COLUMN_NAME eq $HEADER_FIELD->get('name')}<img class="{$SORT_IMAGE}">{/if}
</a>
</th>
{/foreach}
</tr>
</thead>
{foreach item=RELATED_RECORD from=$RELATED_RECORDS}
{assign var=BASE_CURRENCY_DETAILS value=$RELATED_RECORD->getBaseCurrencyDetails()}
<tr class="listViewEntries" data-id='{$RELATED_RECORD->getId()}' data-recordUrl='{$RELATED_RECORD->getDetailViewUrl()}'>
{foreach item=HEADER_FIELD from=$RELATED_HEADERS}
{assign var=RELATED_HEADERNAME value=$HEADER_FIELD->get('name')}
<td nowrap class="{$WIDTHTYPE}">
{if $HEADER_FIELD->get('name') == 'listprice'}
{$RELATED_RECORD->get($HEADER_FIELD->get('name'))}
{assign var="LISTPRICE" value=$RELATED_RECORD->get($HEADER_FIELD->get('name'))}
{else if $HEADER_FIELD->isNameField() eq true or $HEADER_FIELD->get('uitype') eq '4'}
<a href="{$RELATED_RECORD->getDetailViewUrl()}">{$RELATED_RECORD->getDisplayValue($RELATED_HEADERNAME)}</a>
{else}
{$RELATED_RECORD->getDisplayValue($RELATED_HEADERNAME)}
{/if}
{if $HEADER_FIELD@last}
</td><td nowrap class="{$WIDTHTYPE}">
<div class="pull-right actions">
<span class="actionImages">
<a href="{$RELATED_RECORD->getFullDetailViewUrl()}"><i title="{vtranslate('LBL_SHOW_COMPLETE_DETAILS', $MODULE)}" class="icon-th-list alignMiddle"></i></a>&nbsp;
<a data-url="index.php?module=PriceBooks&view=ListPriceUpdate&record={$PARENT_RECORD->getId()}&relid={$RELATED_RECORD->getId()}&currentPrice={$LISTPRICE}"
class="editListPrice cursorPointer" data-related-recordid='{$RELATED_RECORD->getId()}' data-list-price={$LISTPRICE}>
<i class="icon-pencil alignMiddle" title="{vtranslate('LBL_EDIT', $MODULE)}"></i>
</a>
<a class="relationDelete"><i title="{vtranslate('LBL_DELETE', $MODULE)}" class="icon-trash alignMiddle"></i></a>
</span>
</div>
</td>
{/if}
</td>
{/foreach}
</tr>
{/foreach}
</table>
</div>
</div>
</div>
{/strip}

View File

@@ -0,0 +1,127 @@
/*+***********************************************************************************
* 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.
*************************************************************************************/
Vtiger_Detail_Js("PriceBooks_Detail_Js",{},{
listPriceUpdateContainer : false,
/**
* Function to get listPrice update container
*/
getListPriceUpdateContainer : function(){
return this.listPriceUpdateContainer;
},
/**
* Function to register event for select button click on pricebooks related list
*/
registerEventForSelectRecords : function(){
var thisInstance = this;
var detailContentsHolder = this.getContentHolder();
detailContentsHolder.on('click', 'button.selectRelation', function(e){
var selectedTabElement = thisInstance.getSelectedTab();
var relatedModuleName = thisInstance.getRelatedModuleName();
var relatedController = new PriceBooks_RelatedList_Js(thisInstance.getRecordId(), app.getModuleName(), selectedTabElement, relatedModuleName);
relatedController.showSelectRelationPopup();
});
},
/**
* Function to registerevent for updatelistprice in modal window on click of save
*/
registerEventforUpdateListPrice : function(){
var thisInstance = this;
var container = jQuery('#listPriceUpdate');
container.on('submit',function(e){
e.preventDefault();
var invalidFields = container.data('jqv').InvalidFields;
if((invalidFields.length) == 0){
var idList = new Array();
var relid = container.find('input[name="relid"]').val();
var listPriceVal = container.find('input[name="currentPrice"]').val();
idList.push({'id' : relid,'price' : listPriceVal});
var relatedListInstance = new PriceBooks_RelatedList_Js(thisInstance.getRecordId(), app.getModuleName(), thisInstance.getSelectedTab(), thisInstance.getRelatedModuleName());
relatedListInstance.addRelations(idList);
app.hideModalWindow();
var relatedCurrentPage = relatedListInstance.getCurrentPageNum();
var params = {'page':relatedCurrentPage};
relatedListInstance.loadRelatedList(params);
}
})
},
/**
* Function to show listprice update form
*/
showListPriceUpdate : function(data){
app.showModalWindow(data,{'text-align':'left'});
jQuery('#listPriceUpdate').validationEngine(app.validationEngineOptions);
this.registerEventforUpdateListPrice();
},
/**
* Function to get listprice edit form
*/
getListPriceEditForm : function(requestUrl){
var aDeferred = jQuery.Deferred();
var thisInstance = this;
var listPriceContainer = this.getListPriceUpdateContainer();
if(listPriceContainer != false){
aDeferred.resolve(listPriceContainer);
}else{
AppConnector.request(requestUrl).then(
function(data){
thisInstance.listPriceUpdateContainer = data;
aDeferred.resolve(data);
},
function(textStatus, errorThrown){
aDeferred.reject(textStatus, errorThrown);
}
);
}
return aDeferred.promise();
},
/**
* function to register event for editing the list price in related list
*/
registerEventForEditListPrice : function(){
var thisInstance = this;
var detailContentsHolder = this.getContentHolder();
detailContentsHolder.on('click', 'a.editListPrice', function(e){
e.stopPropagation();
var elem = jQuery(e.currentTarget);
var requestUrl = elem.data('url');
thisInstance.getListPriceEditForm(requestUrl).then(
function(data){
var relid = elem.data('relatedRecordid');
var listPrice = elem.data('listPrice');
var form = jQuery(data);
form.find('input[name="relid"]').val(relid);
form.find('input[name="currentPrice"]').val(listPrice);
thisInstance.showListPriceUpdate(form);
},
function(error,err){
}
);
});
},
/**
* Function to register events
*/
registerEvents : function(){
this._super();
this.registerEventForSelectRecords();
this.registerEventForEditListPrice();
}
})

View File

@@ -0,0 +1,25 @@
/*+***********************************************************************************
* 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.
*************************************************************************************/
Vtiger_Popup_Js("PriceBooks_Popup_Js",{},{
/**
* Function to pass params for request
*/
getCompleteParams : function(){
var params = this._super();
params['currency_id'] = jQuery('#currencyId').val();
return params;
},
registerEvents: function(){
this._super();
}
});

View File

@@ -0,0 +1,164 @@
/*+***********************************************************************************
* 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.
*************************************************************************************/
Vtiger_Popup_Js("PriceBook_Products_Popup_Js",{
},{
/**
* Function to register event for enabling list price
*/
checkBoxChangeHandler : function(e){
this._super(e);
var elem = jQuery(e.currentTarget);
var parentRow = elem.closest('tr');
if(elem.is(':checked')) {
jQuery('input[name=listPrice]',parentRow).removeClass('invisible');
}else{
jQuery('input[name=listPrice]',parentRow).addClass('invisible');
}
},
/**
* Function to register event for add to pricebook button in the popup
*/
registerSelectButton : function(){
var popupPageContentsContainer = jQuery('#popupPage')
var thisInstance = this;
popupPageContentsContainer.on('jqv.form.result', function(e){
e.preventDefault();
var tableEntriesElement = popupPageContentsContainer.find('table.listViewEntriesTable');
var selectedRecords = jQuery('input.entryCheckBox', tableEntriesElement).filter(':checked');
if((selectedRecords.length) == 0){
var message = app.vtranslate("JS_PLEASE_SELECT_ONE_RECORD");
Vtiger_Helper_Js.showConfirmationBox({'message' : message})
return;
}
var invalidFields = popupPageContentsContainer.data('jqv').InvalidFields;
if((invalidFields.length) == 0){
var selectedRecordDetails = new Array();
selectedRecords.each(function(index, checkBoxElement){
var checkBoxJqueryObject = jQuery(checkBoxElement)
var row = checkBoxJqueryObject.closest('tr');
var rowListPrice = row.find('input[name=listPrice]');
var listPrice = rowListPrice.val();
var id = row.data('id');
selectedRecordDetails.push({'id' : id,'price' : listPrice});
});
thisInstance.done(selectedRecordDetails, thisInstance.getEventName());
}
});
},
/**
* Function to handle select all in the popup
*/
selectAllHandler : function(e){
this._super(e);
var currentElement = jQuery(e.currentTarget);
var isMainCheckBoxChecked = currentElement.is(':checked');
var tableElement = currentElement.closest('table');
if(isMainCheckBoxChecked) {
jQuery('input.entryCheckBox', tableElement).closest('tr').find('input[name="listPrice"]').removeClass('invisible');
}else {
jQuery('input.entryCheckBox', tableElement).closest('tr').find('input[name="listPrice"]').addClass('invisible');
}
},
/**
* Function to register event for actions buttons
*/
registerEventForActionsButtons : function(){
var thisInstance = this;
var popupPageContentsContainer = this.getPopupPageContainer();
popupPageContentsContainer.on('click','a.cancelLink',function(e){
thisInstance.done();
})
},
/**
* Function to get Page Records
*/
getPageRecords : function(params){
var thisInstance = this;
var aDeferred = jQuery.Deferred();
this._super(params).then(
function(data){
thisInstance.popupSlimScroll();
var form = jQuery('#popupPage');
form.validationEngine('detach');
form.validationEngine('attach');
aDeferred.resolve(data);
},
function(textStatus, errorThrown){
aDeferred.reject(textStatus, errorThrown);
}
);
return aDeferred.promise();
},
/**
* Function to handle sort
*/
sortHandler : function(headerElement){
var thisInstance = this;
//Listprice column should not be sorted so checking for class noSorting
if(headerElement.hasClass('noSorting')){
return;
}
this._super(headerElement).then(
function(data){
thisInstance.popupSlimScroll();
var form = jQuery('#popupPage');
form.validationEngine('detach');
form.validationEngine('attach');
},
function(textStatus, errorThrown){
}
);
},
/**
* Function to handle slim scroll for popup
*/
popupSlimScroll : function(){
var popupPageContentsContainer = this.getPopupPageContainer();
var element = popupPageContentsContainer.find('.popupEntriesDiv');
app.showScrollBar(element, {"height" : '400px'});
},
/**
* Function which will register event when user clicks on the row
*/
registerEventForListViewEntries : function() {
//To Make sure we will not close the window once he clicks on the row,
//which is default behaviour in normal popup
return true;
},
registerEventForListViewEntries : function(){
var popupPageContentsContainer = this.getPopupPageContainer();
popupPageContentsContainer.on('click','.listViewEntries',function(e){
return;
});
},
/**
* Function to register events
*/
registerEvents : function(){
this._super();
this.registerEventForActionsButtons();
this.popupSlimScroll();
jQuery('#popupPage').validationEngine({promptPosition : "topRight"});
}
});

View File

@@ -0,0 +1,68 @@
/*+***********************************************************************************
* 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.
*************************************************************************************/
Vtiger_RelatedList_Js("PriceBooks_RelatedList_Js",{},{
/**
* Function to handle the popup show
*/
showSelectRelationPopup : function(){
var thisInstance = this;
var popupInstance = Vtiger_Popup_Js.getInstance();
popupInstance.show(this.getPopupParams(), function(responseString){
var responseData = JSON.parse(responseString);
thisInstance.addRelations(responseData).then(
function(data){
var relatedCurrentPage = thisInstance.getCurrentPageNum();
var params = {'page':relatedCurrentPage};
thisInstance.loadRelatedList(params);
}
);
}
);
},
/**
* Function to get params for show event invocation
*/
getPopupParams : function(){
var parameters = {
'module' : this.relatedModulename,
'src_module' :this.parentModuleName ,
'src_record' : this.parentRecordId,
'view' : "PriceBookProductPopup",
'src_field' : 'priceBookRelatedList',
'multi_select' : true
}
return parameters;
},
/**
* Function to handle the adding relations between parent and child window
*/
addRelations : function(idList){
var aDeferred = jQuery.Deferred();
var sourceRecordId = this.parentRecordId;
var sourceModuleName = this.parentModuleName;
var relatedModuleName = this.relatedModulename;
var params = {};
params['mode'] = "addListPrice";
params['module'] = sourceModuleName;
params['action'] = 'RelationAjax';
params['related_module'] = relatedModuleName;
params['src_record'] = sourceRecordId;
params['relinfo'] = JSON.stringify(idList);
AppConnector.request(params).then(
function(responseData){
aDeferred.resolve(responseData);
}
);
return aDeferred.promise();
}
})

View File

@@ -0,0 +1,24 @@
{*<!--
/*********************************************************************************
** 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.
*
********************************************************************************/
-->*}
{strip}
{assign var="FIELD_INFO" value=Vtiger_Util_Helper::toSafeHTML(Zend_Json::encode($FIELD_MODEL->getFieldInfo()))}
{assign var="SPECIAL_VALIDATOR" value=$FIELD_MODEL->getValidator()}
{assign var="FIELD_NAME" value=$FIELD_MODEL->get('name')}
<input type="hidden" name="{$FIELD_MODEL->getFieldName()}" value="{if $IS_RELATION eq true}1{else}0{/if}" />
<input id="{$MODULE}_editView_fieldName_{$FIELD_NAME}" type="checkbox" name="{$FIELD_MODEL->getFieldName()}"
data-validation-engine="validate[funcCall[Vtiger_Base_Validator_Js.invokeValidation]]" data-fieldinfo='{$FIELD_INFO}'
{if $FIELD_MODEL->get('fieldvalue') eq true} checked {/if}
{if $IS_RELATION eq true} disabled="disabled" {/if}
{if !empty($SPECIAL_VALIDATOR)}data-validator={Zend_Json::encode($SPECIAL_VALIDATOR)}{/if}
/>
{/strip}