Ejemplo n.º 1
0
         show_window(__('Custom template fields'), $documents->customDocumentFieldsForm());
         if (wf_CheckPost(array('customfields'))) {
             $documents->setCustomFields();
             $templateData = array_merge($templateData, $documents->getCustomFields());
             //parse document template
             $docx = new DOCXTemplate($fullPath);
             $docx->set($templateData);
             $docx->saveAs($saveFullPath);
             //registering generated custom fields document
             $documents->registerDocument($documents->getLogin(), $docId, $saveFileName);
             //output
             zb_DownloadFile($saveFullPath, 'docx');
         }
     } else {
         //parse document template
         $docx = new DOCXTemplate($fullPath);
         $docx->set($templateData);
         $docx->saveAs($saveFullPath);
         //registering generated document
         $documents->registerDocument($documents->getLogin(), $docId, $saveFileName);
         //output
         zb_DownloadFile($saveFullPath, 'docx');
     }
 } else {
     //template downloading
     if (wf_CheckGet(array('download'))) {
         zb_DownloadFile($documents::TEMPLATES_PATH . $_GET['download'], 'docx');
     }
     //template deletion
     if (wf_CheckGet(array('deletetemplate'))) {
         $documents->deleteTemplate($_GET['deletetemplate']);
Ejemplo n.º 2
0
            $template['AGENTID'] = !empty($user['agent']['id']) ? $user['agent']['id'] : '';
            $template['AGENTBANKACC'] = !empty($user['agent']['bankacc']) ? $user['agent']['bankacc'] : '';
            $template['AGENTBANKNAME'] = !empty($user['agent']['bankname']) ? $user['agent']['bankname'] : '';
            $template['AGENTBANKCODE'] = !empty($user['agent']['bankcode']) ? $user['agent']['bankcode'] : '';
            $template['AGENTIPN'] = !empty($user['agent']['ipn']) ? $user['agent']['ipn'] : '';
            $template['AGENTLICENSE'] = !empty($user['agent']['licensenum']) ? $user['agent']['licensenum'] : '';
            $template['AGENTJURADDR'] = !empty($user['agent']['juraddr']) ? $user['agent']['juraddr'] : '';
            $template['AGENTPHISADDR'] = !empty($user['agent']['phisaddr']) ? $user['agent']['phisaddr'] : '';
            $template['AGENTPHONE'] = !empty($user['agent']['phone']) ? $user['agent']['phone'] : '';
            // Update fix:
            switch (true) {
                case !file_exists(DATA_PATH . 'documents/printcheck.docx'):
                    if (file_exists(CONFIG_PATH . '/printcheck.docx')) {
                        if (copy(CONFIG_PATH . '/printcheck.docx', DATA_PATH . 'documents/printcheck.docx')) {
                            unlink(CONFIG_PATH . '/printcheck.docx');
                        }
                    }
                default:
                    $docx = new DOCXTemplate(DATA_PATH . 'documents/printcheck.docx');
                    $docx->set($template);
                    $docx->downloadAs('check-' . $payment['id'] . '.docx');
                    break;
            }
        } else {
            print zb_PrintCheck($paymentid);
            die;
        }
    }
} else {
    show_error(__('You cant control this module'));
}