|
1480 | 1480 | var accounts = args.data.accounts; |
1481 | 1481 | var accountList = args.data.accountlist; |
1482 | 1482 |
|
1483 | | - if ((accounts !== undefined || accountList !== undefined) && projects !== undefined) { |
1484 | | - //Let API throw Runtime Exception |
1485 | | - } else { |
1486 | | - if ((accounts !== undefined || accountList !== undefined) && projects === undefined) { |
1487 | | - var accountNames = ""; |
1488 | | - if (accountList !== undefined && accounts === undefined) { |
1489 | | - accountNames = accountList; |
1490 | | - } else { |
1491 | | - if (Object.prototype.toString.call(accounts) === '[object Array]') { |
1492 | | - accountNames = accounts.join(","); |
1493 | | - } else { |
1494 | | - accountNames = accounts; |
1495 | | - } |
1496 | | - } |
1497 | | - $.extend(data, { |
1498 | | - accounts: accountNames |
1499 | | - }); |
1500 | | - } else if ((accounts === undefined || accountList === undefined) && projects !== undefined) { |
1501 | | - var projectIds = ""; |
1502 | | - if (Object.prototype.toString.call(projects) === '[object Array]') { |
1503 | | - projectIds = projects.join(","); |
| 1483 | + if (accounts !== undefined || (accountList !== undefined && accountList.length > 0)) { |
| 1484 | + var accountNames = ""; |
| 1485 | + if (accountList !== undefined && accounts === undefined) { |
| 1486 | + accountNames = accountList; |
| 1487 | + } else { |
| 1488 | + if (Object.prototype.toString.call(accounts) === '[object Array]') { |
| 1489 | + accountNames = accounts.join(","); |
1504 | 1490 | } else { |
1505 | | - projectIds = projects; |
| 1491 | + accountNames = accounts; |
1506 | 1492 | } |
1507 | | - $.extend(data, { |
1508 | | - projectids: projectIds |
1509 | | - }); |
1510 | 1493 | } |
| 1494 | + $.extend(data, { |
| 1495 | + accounts: accountNames |
| 1496 | + }); |
| 1497 | + } |
| 1498 | + |
| 1499 | + if (projects !== undefined) { |
| 1500 | + var projectIds = ""; |
| 1501 | + if (Object.prototype.toString.call(projects) === '[object Array]') { |
| 1502 | + projectIds = projects.join(","); |
| 1503 | + } else { |
| 1504 | + projectIds = projects; |
| 1505 | + } |
| 1506 | + |
| 1507 | + $.extend(data, { |
| 1508 | + projectids: projectIds |
| 1509 | + }); |
1511 | 1510 | } |
1512 | 1511 | } |
| 1512 | + |
1513 | 1513 | $.ajax({ |
1514 | 1514 | url: createURL('updateTemplatePermissions'), |
1515 | 1515 | data: data, |
|
0 commit comments