Commit | Line | Data |
---|---|---|
2aa397bc | 1 | <?php |
2aa397bc TO |
2 | /* |
3 | * To change this license header, choose License Headers in Project Properties. | |
4 | * To change this template file, choose Tools | Templates | |
5 | * and open the template in the editor. | |
6 | */ | |
7 | ||
8 | /** | |
9 | * Description of EntityApplyChangesTo | |
10 | * | |
11 | * @author Priyanka | |
12 | */ | |
2aa397bc TO |
13 | class CRM_Core_Page_AJAX_RecurringEntity { |
14 | ||
15 | public static function updateMode() { | |
be2fb01f | 16 | $finalResult = []; |
de6c59ca | 17 | if (!empty($_REQUEST['mode']) && !empty($_REQUEST['entityId']) && !empty($_REQUEST['entityTable'])) { |
2aa397bc TO |
18 | $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer'); |
19 | $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer'); | |
20 | $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String'); | |
a1bfea17 | 21 | $priceSet = CRM_Utils_Type::escape($_REQUEST['priceSet'], 'String'); |
55d676f2 AP |
22 | |
23 | // CRM-21764 fix | |
24 | // Retrieving existing priceset if price set id is not passed | |
25 | if ($priceSet == "") { | |
26 | $priceSetEntity = new CRM_Price_DAO_PriceSetEntity(); | |
27 | $priceSetEntity->entity_id = $entityId; | |
28 | $priceSetEntity->entity_table = $entityTable; | |
29 | $priceSetEntity->find(TRUE); | |
30 | $priceSet = $priceSetEntity->price_set_id; | |
31 | } | |
543aa76e AP |
32 | $linkedEntityTable = $_REQUEST['linkedEntityTable']; |
33 | $finalResult = CRM_Core_BAO_RecurringEntity::updateModeAndPriceSet($entityId, $entityTable, $mode, $linkedEntityTable, $priceSet); | |
2aa397bc | 34 | } |
3c7bb1b1 | 35 | CRM_Utils_JSON::output($finalResult); |
2aa397bc | 36 | } |
96025800 | 37 | |
2aa397bc | 38 | } |