Example #1
0
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
/**
 *       \file       htdocs/imports/index.php
 *       \ingroup    import
 *       \brief      Page accueil de la zone import
 */
require_once "../main.inc.php";
require_once DOL_DOCUMENT_ROOT . "/imports/class/import.class.php";
$langs->load("exports");
if (!$user->societe_id == 0) {
    accessforbidden();
}
$import = new Import($db);
$import->load_arrays($user);
/*
 * View
 */
$form = new Form($db);
llxHeader('', $langs->trans("ImportArea"), 'EN:Module_Imports_En|FR:Module_Imports|ES:M&oacute;dulo_Importaciones');
print_fiche_titre($langs->trans("ImportArea"));
print $langs->trans("FormatedImportDesc1") . '<br>';
print $langs->trans("FormatedImportDesc2") . '<br>';
print '<br>';
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td valign="top" width="40%" class="notopnoleft">';
// Liste des formats d'imports disponibles
$var = true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
Example #2
0
    $socid = $user->societe_id;
}
$result = restrictedArea($user, 'import', $origin_id, '');
$entitytoicon = array('invoice' => 'bill', 'invoice_line' => 'bill', 'order' => 'order', 'order_line' => 'order', 'intervention' => 'intervention', 'inter_line' => 'intervention', 'member' => 'user', 'member_type' => 'group', 'subscription' => 'payment', 'tax' => 'generic', 'tax_type' => 'generic', 'account' => 'account', 'payment' => 'payment', 'product' => 'product', 'stock' => 'generic', 'warehouse' => 'stock', 'category' => 'generic', 'other' => 'generic');
$entitytolang = array('user' => 'User', 'company' => 'Company', 'contact' => 'Contact', 'invoice' => 'Bill', 'invoice_line' => 'InvoiceLine', 'order' => 'Order', 'order_line' => 'OrderLine', 'intervention' => 'Intervention', 'inter_line' => 'InterLine', 'member' => 'Member', 'member_type' => 'MemberType', 'subscription' => 'Subscription', 'tax' => 'SocialContribution', 'tax_type' => 'DictionnarySocialContributions', 'account' => 'BankTransactions', 'payment' => 'Payment', 'product' => 'Product', 'stock' => 'Stock', 'warehouse' => 'Warehouse', 'category' => 'Category', 'other' => 'Other');
$datatoimport = GETPOST('datatoimport');
$format = GETPOST('format');
$filetoimport = GETPOST('filetoimport');
$action = GETPOST('action');
$step = GETPOST('step') ? GETPOST('step') : 1;
$import_name = GETPOST('import_name');
$hexa = GETPOST('hexa');
$importmodelid = GETPOST('importmodelid');
$excludefirstline = GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 0;
$objimport = new Import($db);
$objimport->load_arrays($user, $step == 1 ? '' : $datatoimport);
$objmodelimport = new ModeleImports();
$form = new Form($db);
$htmlother = new FormOther($db);
$formfile = new FormFile($db);
// Init $array_match_file_to_database from _SESSION
$serialized_array_match_file_to_database = isset($_SESSION["dol_array_match_file_to_database"]) ? $_SESSION["dol_array_match_file_to_database"] : '';
$array_match_file_to_database = array();
$fieldsarray = explode(',', $serialized_array_match_file_to_database);
foreach ($fieldsarray as $elem) {
    $tabelem = explode('=', $elem, 2);
    $key = $tabelem[0];
    $val = $tabelem[1];
    if ($key && $val) {
        $array_match_file_to_database[$key] = $val;
    }
Example #3
0
require_once DOL_DOCUMENT_ROOT . '/imports/class/import.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/import/modules_import.php';
$datatoimport = GETPOST('datatoimport');
$format = GETPOST('format');
$langs->load("exports");
// Check exportkey
if (empty($datatoimport)) {
    $user->getrights();
    llxHeader();
    print '<div class="error">Bad value for datatoimport.</div>';
    llxFooter();
    exit;
}
$filename = $langs->trans("ExampleOfImportFile") . '_' . $datatoimport . '.' . $format;
$objimport = new Import($db);
$objimport->load_arrays($user, $datatoimport);
// Load arrays from descriptor module
$entity = $objimport->array_import_entities[0][$code];
$entityicon = $entitytoicon[$entity] ? $entitytoicon[$entity] : $entity;
$entitylang = $entitytolang[$entity] ? $entitytolang[$entity] : $entity;
$fieldstarget = $objimport->array_import_fields[0];
$valuestarget = $objimport->array_import_examplevalues[0];
$attachment = true;
if (isset($_GET["attachment"])) {
    $attachment = $_GET["attachment"];
}
//$attachment = false;
$contenttype = dol_mimetype($format);
if (isset($_GET["contenttype"])) {
    $contenttype = $_GET["contenttype"];
}