| @@ -92,8 +92,14 @@ | ||
| 92 | 92 | $this->set('cached_entry', get_transient('e2pdf_' . $this->get('dataset'))); |
| 93 | 93 | } else { |
| 94 | 94 | $entry = FrmEntry::getOne($this->get('dataset')); |
| 95 | 95 | if ($entry && isset($entry->form_id) && $entry->form_id == $this->get('cached_form')->id) { |
| 96 | + if (!empty($entry->parent_item_id)) { | |
| 97 | + $parent_entry = FrmEntry::getOne($entry->parent_item_id); | |
| 98 | + if ($parent_entry && isset($parent_entry->form_id)) { | |
| 99 | + $entry->parent_entry = $parent_entry; | |
| 100 | + } | |
| 101 | + } | |
| 96 | 102 | $this->set('cached_entry', $entry); |
| 97 | 103 | } |
| 98 | 104 | } |
| 99 | 105 | } |
| @@ -101,8 +107,14 @@ | ||
| 101 | 107 | case 'dataset2': |
| 102 | 108 | if ($this->get('cached_form2') && $this->get('dataset2') && class_exists('FrmEntry')) { |
| 103 | 109 | $entry = FrmEntry::getOne($this->get('dataset2')); |
| 104 | 110 | if ($entry && isset($entry->form_id) && $entry->form_id == $this->get('cached_form2')->id) { |
| 111 | + if (!empty($entry->parent_item_id)) { | |
| 112 | + $parent_entry = FrmEntry::getOne($entry->parent_item_id); | |
| 113 | + if ($parent_entry && isset($parent_entry->form_id)) { | |
| 114 | + $entry->parent_entry = $parent_entry; | |
| 115 | + } | |
| 116 | + } | |
| 105 | 117 | $this->set('cached_entry2', $entry); |
| 106 | 118 | } |
| 107 | 119 | } |
| 108 | 120 | break; |
| @@ -3514,10 +3526,12 @@ | ||
| 3514 | 3526 | $html = ''; |
| 3515 | 3527 | $source = ''; |
| 3516 | 3528 | |
| 3517 | 3529 | if ($this->get('item') && class_exists('FrmformsController')) { |
| 3518 | - if ($this->get('cached_form') && $this->get('cached_form')->parent_form_id) { | |
| 3519 | - return '<div class="e2pdf-vm-error">' . __("Child form doesn't support Visual Mapper", 'e2pdf') . '</div>'; | |
| 3530 | + $child = false; | |
| 3531 | + if ($this->get('cached_form') && !empty($this->get('cached_form')->parent_form_id)) { | |
| 3532 | + $child = true; | |
| 3533 | + $this->set('item', $this->get('cached_form')->parent_form_id); | |
| 3520 | 3534 | } |
| 3521 | 3535 | if (class_exists('FrmProFieldsHelper')) { |
| 3522 | 3536 | add_filter('frm_get_paged_fields', array($this, 'filter_remove_pagebreaks'), 9); |
| 3523 | 3537 | } |
| @@ -3621,12 +3635,12 @@ | ||
| 3621 | 3635 | /* |
| 3622 | 3636 | * Metas patterns to replace field names |
| 3623 | 3637 | * @since 0.01.42 |
| 3624 | 3638 | */ |
| 3625 | - $metas_pattern = array( | |
| 3626 | - '/item_meta\[(?:.*?)\]\[0\]\[(.*?)\](?:\[\])?/i' => '$1:1', | |
| 3639 | + $metas_pattern = [ | |
| 3640 | + '/item_meta\[(?:.*?)\]\[0\]\[(.*?)\](?:\[\])?/i' => $child ? '$1' : '$1:1', | |
| 3627 | 3641 | '/item_meta\[(.*?)\](\[\])?/i' => '$1', |
| 3628 | - ); | |
| 3642 | + ]; | |
| 3629 | 3643 | |
| 3630 | 3644 | // replace names |
| 3631 | 3645 | $metas = $xpath->query("//*[contains(@name, 'item_meta')]"); |
| 3632 | 3646 | foreach ($metas as $element) { |