Skip to content

Commit

Permalink
Merge branch 'hotfix' of github.com:NETivism/netiCRM into hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Nov 6, 2024
2 parents 23f2f17 + 097d174 commit 1b84be0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions templates/CRM/common/additionalBlocks.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cj( function( ) {
{if $generateAjaxRequest}
{foreach from=$ajaxRequestBlocks key="blockName" item="instances"}
{foreach from=$instances key="instance" item="active"}
buildAdditionalBlocks( '{$blockName}', '{$className}' );
buildAdditionalBlocks( '{$blockName}', '{$className}', '{$instance}');
{/foreach}
{/foreach}
{/if}
Expand All @@ -43,12 +43,16 @@ cj( function( ) {
{literal}
});

function buildAdditionalBlocks( blockName, className ) {
function buildAdditionalBlocks( blockName, className , $instance = null ) {
var element = blockName + '_Block_';

//get blockcount of last element of relevant blockName
var previousInstance = cj( '[id^="'+ element +'"]:last' ).attr('id').slice( element.length );
var currentInstance = parseInt( previousInstance ) + 1;
if (!$instance) {
var currentInstance = parseInt( previousInstance ) + 1;
} else {
var currentInstance = $instance;
}

//show primary option if block count = 2
if ( currentInstance == 2) {
Expand Down

0 comments on commit 1b84be0

Please sign in to comment.