|
1491 | 1491 | var accounts = args.data.accounts; |
1492 | 1492 | var accountList = args.data.accountlist; |
1493 | 1493 |
|
1494 | | - if ((accounts !== undefined || accountList !== undefined) && projects !== undefined) { |
1495 | | - //Let API throw Runtime Exception |
1496 | | - } else { |
1497 | | - if ((accounts !== undefined || accountList !== undefined) && projects === undefined) { |
1498 | | - var accountNames = ""; |
1499 | | - if (accountList !== undefined && accounts === undefined) { |
1500 | | - accountNames = accountList; |
1501 | | - } else { |
1502 | | - if (Object.prototype.toString.call(accounts) === '[object Array]') { |
1503 | | - accountNames = accounts.join(","); |
1504 | | - } else { |
1505 | | - accountNames = accounts; |
1506 | | - } |
1507 | | - } |
1508 | | - $.extend(data, { |
1509 | | - accounts: accountNames |
1510 | | - }); |
1511 | | - } else if ((accounts === undefined || accountList === undefined) && projects !== undefined) { |
1512 | | - var projectIds = ""; |
1513 | | - if (Object.prototype.toString.call(projects) === '[object Array]') { |
1514 | | - projectIds = projects.join(","); |
| 1494 | + if (accounts !== undefined || (accountList !== undefined && accountList.length > 0)) { |
| 1495 | + var accountNames = ""; |
| 1496 | + if (accountList !== undefined && accounts === undefined) { |
| 1497 | + accountNames = accountList; |
| 1498 | + } else { |
| 1499 | + if (Object.prototype.toString.call(accounts) === '[object Array]') { |
| 1500 | + accountNames = accounts.join(","); |
1515 | 1501 | } else { |
1516 | | - projectIds = projects; |
| 1502 | + accountNames = accounts; |
1517 | 1503 | } |
1518 | | - $.extend(data, { |
1519 | | - projectids: projectIds |
1520 | | - }); |
1521 | 1504 | } |
| 1505 | + $.extend(data, { |
| 1506 | + accounts: accountNames |
| 1507 | + }); |
| 1508 | + } |
| 1509 | + |
| 1510 | + if (projects !== undefined) { |
| 1511 | + var projectIds = ""; |
| 1512 | + if (Object.prototype.toString.call(projects) === '[object Array]') { |
| 1513 | + projectIds = projects.join(","); |
| 1514 | + } else { |
| 1515 | + projectIds = projects; |
| 1516 | + } |
| 1517 | + |
| 1518 | + $.extend(data, { |
| 1519 | + projectids: projectIds |
| 1520 | + }); |
1522 | 1521 | } |
1523 | 1522 | } |
| 1523 | + |
1524 | 1524 | $.ajax({ |
1525 | 1525 | url: createURL('updateTemplatePermissions'), |
1526 | 1526 | data: data, |
|
0 commit comments