* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. */ /** * \file importzugferd/admin/setup.php * \ingroup importzugferd * \brief ImportZugferd setup page. */ // Load Dolibarr environment $res = 0; if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; } $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res && file_exists("../../../main.inc.php")) { $res = @include "../../../main.inc.php"; } if (!$res) { die("Include of main fails"); } // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/importzugferd.lib.php'; // Translations $langs->loadLangs(array("admin", "importzugferd@importzugferd")); // Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Access control if (!$user->admin) { accessforbidden(); } // Form setup using FormSetup class if (!class_exists('FormSetup')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } $formSetup = new FormSetup($db); /* * Setup configuration items */ // IMAP Settings Section $formSetup->newItem('IMAPSettings')->setAsTitle(); $item = $formSetup->newItem('IMPORTZUGFERD_IMAP_HOST'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth300'; $item->fieldAttr['placeholder'] = 'imap.example.com'; $item = $formSetup->newItem('IMPORTZUGFERD_IMAP_PORT'); $item->defaultFieldValue = '993'; $item->cssClass = 'width100'; $item = $formSetup->newItem('IMPORTZUGFERD_IMAP_USER'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth300'; $item->fieldAttr['placeholder'] = 'invoices@example.com'; $item = $formSetup->newItem('IMPORTZUGFERD_IMAP_PASSWORD'); $item->cssClass = 'minwidth300'; $item->fieldAttr['type'] = 'password'; $item = $formSetup->newItem('IMPORTZUGFERD_IMAP_FOLDER'); $item->defaultFieldValue = 'INBOX'; $item->cssClass = 'minwidth200'; $formSetup->newItem('IMPORTZUGFERD_IMAP_SSL')->setAsYesNo(); // Import Settings Section $formSetup->newItem('ImportSettings')->setAsTitle(); $formSetup->newItem('IMPORTZUGFERD_AUTO_CREATE_INVOICE')->setAsYesNo(); // Email Notification Settings Section $formSetup->newItem('NotificationSettings')->setAsTitle(); $formSetup->newItem('IMPORTZUGFERD_NOTIFY_ENABLED')->setAsYesNo(); $item = $formSetup->newItem('IMPORTZUGFERD_NOTIFY_EMAIL'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth300'; $item->fieldAttr['placeholder'] = 'admin@example.com'; $formSetup->newItem('IMPORTZUGFERD_NOTIFY_MANUAL')->setAsYesNo(); $formSetup->newItem('IMPORTZUGFERD_NOTIFY_ERROR')->setAsYesNo(); $formSetup->newItem('IMPORTZUGFERD_NOTIFY_PRICE_DIFF')->setAsYesNo(); $item = $formSetup->newItem('IMPORTZUGFERD_PRICE_DIFF_THRESHOLD'); $item->defaultFieldValue = '10'; $item->cssClass = 'width75'; $item->fieldAttr['type'] = 'number'; $item->fieldAttr['min'] = '0'; $item->fieldAttr['max'] = '100'; $item->fieldAttr['step'] = '1'; // Scheduling Settings Section $formSetup->newItem('SchedulingSettings')->setAsTitle(); $item = $formSetup->newItem('IMPORTZUGFERD_IMPORT_FREQUENCY'); $item->setAsSelect(array( 'manual' => $langs->trans('FrequencyManual'), 'hourly' => $langs->trans('FrequencyHourly'), 'daily' => $langs->trans('FrequencyDaily'), 'weekly' => $langs->trans('FrequencyWeekly') )); $item->defaultFieldValue = 'manual'; // Folder Import Settings Section $formSetup->newItem('FolderImportSettings')->setAsTitle(); $item = $formSetup->newItem('IMPORTZUGFERD_WATCH_FOLDER'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth400'; $item->fieldAttr['placeholder'] = '/path/to/invoices'; $item = $formSetup->newItem('IMPORTZUGFERD_ARCHIVE_FOLDER'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth400'; $item->fieldAttr['placeholder'] = '/path/to/archive'; $item = $formSetup->newItem('IMPORTZUGFERD_ERROR_FOLDER'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth400'; $item->fieldAttr['placeholder'] = '/path/to/errors'; $item = $formSetup->newItem('IMPORTZUGFERD_IMAP_ARCHIVE_FOLDER'); $item->defaultFieldValue = 'Archive'; $item->cssClass = 'minwidth200'; // Datanorm Settings Section $formSetup->newItem('DatanormSettings')->setAsTitle(); $item = $formSetup->newItem('IMPORTZUGFERD_DATANORM_MARKUP'); $item->defaultFieldValue = '30'; $item->cssClass = 'width100'; $item->fieldAttr['placeholder'] = '30'; $formSetup->newItem('IMPORTZUGFERD_DATANORM_SEARCH_ALL')->setAsYesNo(); // Accounting Codes Section (Standard-Konten für neue Produkte) $formSetup->newItem('AccountingSettings')->setAsTitle(); $item = $formSetup->newItem('IMPORTZUGFERD_ACCOUNTING_CODE_SELL'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth200'; $item->fieldAttr['placeholder'] = '700000'; $item = $formSetup->newItem('IMPORTZUGFERD_ACCOUNTING_CODE_SELL_INTRA'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth200'; $item->fieldAttr['placeholder'] = '700100'; $item = $formSetup->newItem('IMPORTZUGFERD_ACCOUNTING_CODE_SELL_EXPORT'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth200'; $item->fieldAttr['placeholder'] = '700200'; $item = $formSetup->newItem('IMPORTZUGFERD_ACCOUNTING_CODE_BUY'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth200'; $item->fieldAttr['placeholder'] = '400000'; $item = $formSetup->newItem('IMPORTZUGFERD_ACCOUNTING_CODE_BUY_INTRA'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth200'; $item->fieldAttr['placeholder'] = '400100'; $item = $formSetup->newItem('IMPORTZUGFERD_ACCOUNTING_CODE_BUY_EXPORT'); $item->defaultFieldValue = ''; $item->cssClass = 'minwidth200'; $item->fieldAttr['placeholder'] = '400200'; /* * Actions */ if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) { $formSetup->saveConfFromPost(); } include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; // AJAX action for folder browsing if ($action == 'browse_folders') { $path = GETPOST('path', 'alpha'); $target = GETPOST('target', 'alpha'); // Sanitize path - default to /home for easier navigation if (empty($path)) { $path = '/home'; } $path = realpath($path); if ($path === false) { $path = '/home'; if (!is_dir($path)) { $path = '/'; } } // Get directories $dirs = array(); if (is_dir($path) && is_readable($path)) { $entries = @scandir($path); if ($entries) { foreach ($entries as $entry) { if ($entry == '.') continue; $fullPath = $path . '/' . $entry; if (is_dir($fullPath) && is_readable($fullPath)) { $dirs[] = array( 'name' => $entry, 'path' => $fullPath ); } } } } // Return JSON header('Content-Type: application/json'); echo json_encode(array( 'current' => $path, 'parent' => dirname($path), 'dirs' => $dirs, 'target' => $target )); exit; } // Save folder from browser if ($action == 'set_folder') { $target = GETPOST('target', 'alpha'); $folder_path = GETPOST('folder_path', 'alpha'); if (in_array($target, array('IMPORTZUGFERD_WATCH_FOLDER', 'IMPORTZUGFERD_ARCHIVE_FOLDER'))) { if (is_dir($folder_path)) { dolibarr_set_const($db, $target, $folder_path, 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans('FolderSelected').': '.$folder_path, null, 'mesgs'); } else { setEventMessages($langs->trans('ErrorFolderNotFound'), null, 'errors'); } } header('Location: '.$_SERVER['PHP_SELF']); exit; } /* * View */ $form = new Form($db); $title = "ImportZugferdSetup"; llxHeader('', $langs->trans($title), '', '', 0, 0, '', '', '', 'mod-importzugferd page-admin'); // Subheader $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); // Configuration header $head = importzugferdAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "importzugferd@importzugferd"); // Setup page description print ''.$langs->trans("ImportZugferdSetupPage").'

'; // Display the form print $formSetup->generateOutput(true); // Build folder validation data for JavaScript $folderValidation = array(); // Watch folder - only needs to be readable $watchFolder = getDolGlobalString('IMPORTZUGFERD_WATCH_FOLDER'); if (!empty($watchFolder)) { $watchExists = is_dir($watchFolder); $watchReadable = $watchExists && is_readable($watchFolder); if (!$watchExists) { $folderValidation['IMPORTZUGFERD_WATCH_FOLDER'] = array('ok' => false, 'msg' => $langs->trans('FolderNotFound')); } elseif (!$watchReadable) { $folderValidation['IMPORTZUGFERD_WATCH_FOLDER'] = array('ok' => false, 'msg' => $langs->trans('FolderNotReadable')); } else { $files = glob($watchFolder.'/*.pdf'); $files = array_merge($files ?: [], glob($watchFolder.'/*.PDF') ?: []); $folderValidation['IMPORTZUGFERD_WATCH_FOLDER'] = array('ok' => true, 'msg' => $langs->trans('FolderOK').' ('.count($files).' PDF)'); } } // Archive folder - needs to be writable $archiveFolder = getDolGlobalString('IMPORTZUGFERD_ARCHIVE_FOLDER'); if (!empty($archiveFolder)) { $archiveExists = is_dir($archiveFolder); $archiveWritable = $archiveExists && is_writable($archiveFolder); if (!$archiveExists) { $folderValidation['IMPORTZUGFERD_ARCHIVE_FOLDER'] = array('ok' => false, 'msg' => $langs->trans('FolderNotFound')); } elseif (!$archiveWritable) { $folderValidation['IMPORTZUGFERD_ARCHIVE_FOLDER'] = array('ok' => false, 'msg' => $langs->trans('FolderNotWritable')); } else { $folderValidation['IMPORTZUGFERD_ARCHIVE_FOLDER'] = array('ok' => true, 'msg' => $langs->trans('FolderOK')); } } // Error folder - needs to be writable $errorFolder = getDolGlobalString('IMPORTZUGFERD_ERROR_FOLDER'); if (!empty($errorFolder)) { $errorExists = is_dir($errorFolder); $errorWritable = $errorExists && is_writable($errorFolder); if (!$errorExists) { $folderValidation['IMPORTZUGFERD_ERROR_FOLDER'] = array('ok' => false, 'msg' => $langs->trans('FolderNotFound')); } elseif (!$errorWritable) { $folderValidation['IMPORTZUGFERD_ERROR_FOLDER'] = array('ok' => false, 'msg' => $langs->trans('FolderNotWritable')); } else { $folderValidation['IMPORTZUGFERD_ERROR_FOLDER'] = array('ok' => true, 'msg' => $langs->trans('FolderOK')); } } // Folder Browser Modal print ' '; // Email Notification Test Section if (getDolGlobalString('IMPORTZUGFERD_NOTIFY_ENABLED') && getDolGlobalString('IMPORTZUGFERD_NOTIFY_EMAIL')) { print '
'; print '
'; print ''; print ''; print ''; print ''; // Handle test email action if ($action == 'test_email') { dol_include_once('/importzugferd/class/importnotification.class.php'); $notification = new ImportNotification($db); $result = $notification->sendTestNotification(); if ($result > 0) { setEventMessages($langs->trans('TestEmailSent', getDolGlobalString('IMPORTZUGFERD_NOTIFY_EMAIL')), null, 'mesgs'); } else { setEventMessages($langs->trans('TestEmailFailed').': '.$notification->error, null, 'errors'); } } print ''; print ''; print ''; print ''; print '
'.$langs->trans('TestEmailNotification').'
'.$langs->trans('SendTestEmail').''; print ''; print ''.$langs->trans('SendTestEmail'); print ''; print ' '.$langs->trans('SendTo').': '.getDolGlobalString('IMPORTZUGFERD_NOTIFY_EMAIL').''; print '
'; print '
'; } // Test IMAP connection button and folder selection if (getDolGlobalString('IMPORTZUGFERD_IMAP_HOST')) { print '
'; print '
'; print ''; print ''; print ''; print ''; // Check if IMAP extension is available $imap_available = function_exists('imap_open'); // Test connection action $imap_folders = array(); $connection_ok = false; if (!$imap_available) { print ''; print ''; print ''; } elseif ($action == 'test_imap' || $action == 'select_folder') { $host = getDolGlobalString('IMPORTZUGFERD_IMAP_HOST'); $port = getDolGlobalString('IMPORTZUGFERD_IMAP_PORT', '993'); $imap_user = getDolGlobalString('IMPORTZUGFERD_IMAP_USER'); $password = getDolGlobalString('IMPORTZUGFERD_IMAP_PASSWORD'); $ssl = getDolGlobalString('IMPORTZUGFERD_IMAP_SSL'); $mailbox_base = '{' . $host . ':' . $port . '/imap' . ($ssl ? '/ssl' : '') . '/novalidate-cert}'; $mailbox = $mailbox_base . 'INBOX'; $connection = @imap_open($mailbox, $imap_user, $password); if ($connection) { $connection_ok = true; setEventMessages($langs->trans('ConnectionSuccessful'), null, 'mesgs'); // Get list of folders $folders_raw = imap_list($connection, $mailbox_base, '*'); if ($folders_raw) { foreach ($folders_raw as $folder) { // Remove the mailbox base from folder name $folder_name = str_replace($mailbox_base, '', $folder); // Decode folder name (IMAP uses modified UTF-7) $folder_name_decoded = imap_utf7_decode($folder_name); $imap_folders[$folder_name] = $folder_name_decoded; } } imap_close($connection); } else { setEventMessages($langs->trans('ConnectionFailed') . ': ' . imap_last_error(), null, 'errors'); } } // Save selected folder if ($action == 'select_folder' && GETPOST('imap_folder', 'alpha')) { $selected_folder = GETPOST('imap_folder', 'alpha'); dolibarr_set_const($db, 'IMPORTZUGFERD_IMAP_FOLDER', $selected_folder, 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans('FolderSelected').': '.$selected_folder, null, 'mesgs'); } // Only show status and folder selection if IMAP is available if ($imap_available) { print ''; print ''; print ''; print ''; } // Show folder selection if connection was successful if ($imap_available && $connection_ok && !empty($imap_folders)) { print ''; print ''; print ''; print ''; print ''; } // Only show test button if IMAP extension is available if ($imap_available) { print ''; print ''; print ''; } print '
'.$langs->trans('TestConnection').'
'; print ''; print $langs->trans('IMAPExtensionNotInstalled'); print '
'; print ''.$langs->trans('IMAPExtensionHelp').''; print '
'.$langs->trans('Status').''; if ($action == 'test_imap' || $action == 'select_folder') { if ($connection_ok) { print ''.$langs->trans('ConnectionSuccessful').''; } else { print ''.$langs->trans('ConnectionFailed').''; } } else { print ''.$langs->trans('ClickTestToCheck').''; } print '
'.$langs->trans('SelectFolder').''; print '
'; print ''; print ''; $current_folder = getDolGlobalString('IMPORTZUGFERD_IMAP_FOLDER', 'INBOX'); print ''; print ' '; print '
'; print '
'; print ''.$langs->trans('FoundFolders').': '.count($imap_folders).''; print '
'; print ''; print ''.$langs->trans('TestConnection'); print ''; print '
'; print '
'; } // Manual Import Trigger Section $hasFolder = getDolGlobalString('IMPORTZUGFERD_WATCH_FOLDER') && is_dir(getDolGlobalString('IMPORTZUGFERD_WATCH_FOLDER')); $hasImap = getDolGlobalString('IMPORTZUGFERD_IMAP_HOST') && getDolGlobalString('IMPORTZUGFERD_IMAP_USER'); if ($hasFolder || $hasImap) { print '
'; print '
'; print ''; print ''; print ''; print ''; // Handle manual import action if ($action == 'run_import') { $source = GETPOST('import_source', 'alpha'); dol_include_once('/importzugferd/class/zugferdimport.class.php'); dol_include_once('/importzugferd/class/zugferdparser.class.php'); $successCount = 0; $errorCount = 0; $skippedCount = 0; if ($source == 'folder' && $hasFolder) { $watchFolder = getDolGlobalString('IMPORTZUGFERD_WATCH_FOLDER'); $archiveFolder = getDolGlobalString('IMPORTZUGFERD_ARCHIVE_FOLDER'); $errorFolder = getDolGlobalString('IMPORTZUGFERD_ERROR_FOLDER'); $autoCreate = getDolGlobalInt('IMPORTZUGFERD_AUTO_CREATE_INVOICE'); $files = glob($watchFolder.'/*.pdf'); $files = array_merge($files, glob($watchFolder.'/*.PDF')); // Create archive folder if configured but doesn't exist if (!empty($archiveFolder) && !is_dir($archiveFolder)) { dol_mkdir($archiveFolder); } // Create error folder if configured but doesn't exist if (!empty($errorFolder) && !is_dir($errorFolder)) { dol_mkdir($errorFolder); } // Helper function for moving files with fallback $moveFile = function($file, $targetFolder, $prefix) { if (empty($targetFolder)) { return false; } if (!is_dir($targetFolder)) { dol_mkdir($targetFolder); } if (!is_dir($targetFolder) || !is_writable($targetFolder)) { dol_syslog("ImportZugferd: Target folder not accessible: ".$targetFolder, LOG_WARNING); return false; } $destFile = $targetFolder.'/'.$prefix.date('Y-m-d_His').'_'.basename($file); if (@rename($file, $destFile)) { dol_syslog("ImportZugferd: Moved file to: ".$destFile, LOG_INFO); return true; } // Fallback: copy + delete (for cross-filesystem moves) if (@copy($file, $destFile)) { @unlink($file); dol_syslog("ImportZugferd: Copied file to: ".$destFile, LOG_INFO); return true; } dol_syslog("ImportZugferd: Failed to move file: ".$file." to ".$destFile, LOG_ERR); return false; }; foreach ($files as $file) { $import = new ZugferdImport($db); $result = $import->importFromFile($user, $file, $autoCreate); if ($result > 0) { $successCount++; $moveFile($file, $archiveFolder, 'imported_'); } elseif ($result == -2) { // Duplicate - move to archive $skippedCount++; if (!$moveFile($file, $archiveFolder, 'duplicate_')) { @unlink($file); } } else { // Error - move to error folder, fallback to archive $errorCount++; if (!$moveFile($file, $errorFolder, 'error_')) { if (!$moveFile($file, $archiveFolder, 'error_')) { dol_syslog("ImportZugferd: File stays in watch folder: ".$file, LOG_WARNING); } } } } } elseif ($source == 'imap' && $hasImap && function_exists('imap_open')) { $host = getDolGlobalString('IMPORTZUGFERD_IMAP_HOST'); $port = getDolGlobalString('IMPORTZUGFERD_IMAP_PORT', '993'); $imap_user = getDolGlobalString('IMPORTZUGFERD_IMAP_USER'); $password = getDolGlobalString('IMPORTZUGFERD_IMAP_PASSWORD'); $ssl = getDolGlobalString('IMPORTZUGFERD_IMAP_SSL'); $folder = getDolGlobalString('IMPORTZUGFERD_IMAP_FOLDER', 'INBOX'); $archiveFolder = getDolGlobalString('IMPORTZUGFERD_IMAP_ARCHIVE_FOLDER'); $autoCreate = getDolGlobalInt('IMPORTZUGFERD_AUTO_CREATE_INVOICE'); $mailbox = '{' . $host . ':' . $port . '/imap' . ($ssl ? '/ssl' : '') . '/novalidate-cert}' . $folder; $connection = @imap_open($mailbox, $imap_user, $password); if ($connection) { $emails = imap_search($connection, 'UNSEEN'); if ($emails) { foreach ($emails as $email_number) { $structure = imap_fetchstructure($connection, $email_number); // Find PDF attachments if (isset($structure->parts)) { foreach ($structure->parts as $partIndex => $part) { $filename = ''; if ($part->ifdparameters) { foreach ($part->dparameters as $param) { if (strtolower($param->attribute) == 'filename') { $filename = $param->value; } } } if (empty($filename) && $part->ifparameters) { foreach ($part->parameters as $param) { if (strtolower($param->attribute) == 'name') { $filename = $param->value; } } } if (!empty($filename) && preg_match('/\.pdf$/i', $filename)) { $attachment = imap_fetchbody($connection, $email_number, $partIndex + 1); if ($part->encoding == 3) { // BASE64 $attachment = base64_decode($attachment); } elseif ($part->encoding == 4) { // QUOTED-PRINTABLE $attachment = quoted_printable_decode($attachment); } // Save to temp file $tempFile = $conf->importzugferd->dir_temp.'/'.uniqid().'_'.$filename; if (!is_dir($conf->importzugferd->dir_temp)) { dol_mkdir($conf->importzugferd->dir_temp); } file_put_contents($tempFile, $attachment); // Import $import = new ZugferdImport($db); $result = $import->importFromFile($user, $tempFile, $autoCreate); if ($result > 0) { $successCount++; } elseif ($result == -2) { $skippedCount++; } else { $errorCount++; } unlink($tempFile); } } } } // Archive processed emails if (!empty($archiveFolder) && $successCount > 0) { foreach ($emails as $email_number) { imap_mail_move($connection, $email_number, $archiveFolder); } imap_expunge($connection); } } imap_close($connection); } else { setEventMessages($langs->trans('ConnectionFailed').': '.imap_last_error(), null, 'errors'); } } if ($successCount > 0 || $errorCount > 0 || $skippedCount > 0) { setEventMessages($langs->trans('BatchImportComplete', $successCount, $errorCount, $skippedCount), null, 'mesgs'); } else { setEventMessages($langs->trans('NoFilesFound'), null, 'warnings'); } } print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans('ManualImportTrigger').'
'.$langs->trans('ImportFromFolder').''; if ($hasFolder) { print ''; print ''.$langs->trans('StartImport'); print ''; print ' '.getDolGlobalString('IMPORTZUGFERD_WATCH_FOLDER').''; } else { print ''.$langs->trans('ErrorWatchFolderNotConfigured').''; } print '
'.$langs->trans('ImportFromIMAP').''; if ($hasImap && function_exists('imap_open')) { print ''; print ''.$langs->trans('StartImport'); print ''; print ' '.getDolGlobalString('IMPORTZUGFERD_IMAP_USER').''; } elseif (!function_exists('imap_open')) { print ''.$langs->trans('IMAPExtensionNotInstalled').''; } else { print ''.$langs->trans('ErrorIMAPNotConfigured').''; } print '
'; print '
'; } print '
'; // Page end print dol_get_fiche_end(); llxFooter(); $db->close();