--- /tmp/dsg/dolibarr/htdocs/exports/github_export.php +++ /tmp/dsg/dolibarr/htdocs/exports/client_export.php @@ -39,64 +39,63 @@ //if (! $user->admin) // accessforbidden(); -// Map icons, array duplicated in import.php, was not synchronized, TODO put it somewhere only once $entitytoicon = array( 'invoice' => 'bill', - 'invoice_line' => 'bill', + 'invoice_line' => 'bill', 'order' => 'order', - 'order_line' => 'order', + 'order_line' => 'order', 'propal' => 'propal', - 'propal_line' => 'propal', + 'propal_line' => 'propal', 'intervention' => 'intervention', - 'inter_line' => 'intervention', + 'inter_line' => 'intervention', 'member' => 'user', - 'member_type' => 'group', - 'subscription' => 'payment', - 'payment' => 'payment', + 'member_type' => 'group', + 'subscription' => 'payment', + 'payment' => 'payment', 'tax' => 'generic', 'tax_type' => 'generic', + 'stock' => 'generic', 'other' => 'generic', 'account' => 'account', 'product' => 'product', - 'virtualproduct'=>'product', + 'virtualproduct'=>'product', 'subproduct' => 'product', 'product_supplier_ref' => 'product', - 'stock' => 'stock', 'warehouse' => 'stock', 'batch' => 'stock', 'stockbatch' => 'stock', 'category' => 'category', 'shipment' => 'sending', - 'shipment_line'=> 'sending', - 'reception'=> 'sending', - 'reception_line'=> 'sending', + 'shipment_line'=> 'sending', + 'reception'=> 'sending', + 'reception_line'=> 'sending', 'expensereport'=> 'trip', - 'expensereport_line'=> 'trip', + 'expensereport_line'=> 'trip', 'holiday' => 'holiday', - 'contract_line' => 'contract', - 'translation' => 'generic', - 'bomm' => 'bom', - 'bomline' => 'bom' + 'contract_line' => 'contract', + 'translation' => 'generic', + 'bomm' => 'bom', + 'bomline' => 'bom' ); -// Translation code, array duplicated in import.php, was not synchronized, TODO put it somewhere only once +// Translation code $entitytolang = array( 'user' => 'User', 'company' => 'Company', - 'contact' => 'Contact', + 'contact' => 'Contact', 'invoice' => 'Bill', - 'invoice_line' => 'InvoiceLine', + 'invoice_line' => 'InvoiceLine', 'order' => 'Order', - 'order_line' => 'OrderLine', - 'propal' => 'Proposal', - 'propal_line' => 'ProposalLine', + 'order_line' => 'OrderLine', + 'propal' => 'Proposal', + 'propal_line' => 'ProposalLine', 'intervention' => 'Intervention', - 'inter_line' => 'InterLine', + 'inter_line' => 'InterLine', 'member' => 'Member', - 'member_type' => 'MemberType', - 'subscription' => 'Subscription', + 'member_type' => 'MemberType', + 'subscription' => 'Subscription', 'tax' => 'SocialContribution', - 'tax_type' => 'DictionarySocialContributions', + 'tax_type' => 'DictionarySocialContributions', 'account' => 'BankTransactions', 'payment' => 'Payment', 'product' => 'Product', @@ -104,34 +103,34 @@ 'subproduct' => 'SubProduct', 'product_supplier_ref' => 'SupplierPrices', 'service' => 'Service', - 'stock' => 'Stock', + 'stock' => 'Stock', 'movement' => 'StockMovement', 'batch' => 'Batch', 'stockbatch' => 'StockDetailPerBatch', 'warehouse' => 'Warehouse', 'category' => 'Category', 'other' => 'Other', - 'trip' => 'TripsAndExpenses', - 'shipment' => 'Shipments', - 'shipment_line'=> 'ShipmentLine', - 'project' => 'Projects', - 'projecttask' => 'Tasks', - 'task_time' => 'TaskTimeSpent', + 'trip' => 'TripsAndExpenses', + 'shipment' => 'Shipments', + 'shipment_line'=> 'ShipmentLine', + 'project' => 'Projects', + 'projecttask' => 'Tasks', + 'task_time' => 'TaskTimeSpent', 'action' => 'Event', 'expensereport'=> 'ExpenseReport', 'expensereport_line'=> 'ExpenseReportLine', 'holiday' => 'TitreRequestCP', 'contract' => 'Contract', - 'contract_line'=> 'ContractLine', - 'translation' => 'Translation', - 'bom' => 'BOM', - 'bomline' => 'BOMLine' + 'contract_line'=> 'ContractLine', + 'translation' => 'Translation', + 'bom' => 'BOM', + 'bomline' => 'BOMLine' ); $array_selected = isset($_SESSION["export_selected_fields"]) ? $_SESSION["export_selected_fields"] : array(); $array_filtervalue = isset($_SESSION["export_filtered_fields"]) ? $_SESSION["export_filtered_fields"] : array(); $datatoexport = GETPOST("datatoexport", "aZ09"); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $step = GETPOST("step", "int") ?GETPOST("step", "int") : 1; $export_name = GETPOST("export_name", "alphanohtml"); @@ -163,131 +162,137 @@ { $fieldsarray = $objexport->array_export_fields[0]; $fieldsentitiesarray = $objexport->array_export_entities[0]; - $fieldsdependenciesarray = $objexport->array_export_dependencies[0]; - - if ($field == 'all') - { + $fieldsdependenciesarray = $objexport->array_export_dependencies[0]; + + if ($field == 'all') + { foreach ($fieldsarray as $key=>$val) { if (!empty($array_selected[$key])) continue; // If already selected, check next $array_selected[$key] = count($array_selected) + 1; - //print_r($array_selected); - $_SESSION["export_selected_fields"] = $array_selected; - } - } else { - $warnings = array(); - - $array_selected[$field] = count($array_selected) + 1; // We tag the key $field as "selected" - // We check if there is a dependency to activate - /*var_dump($field); + //print_r($array_selected); + $_SESSION["export_selected_fields"] = $array_selected; + } + } + else + { + $warnings = array(); + + $array_selected[$field] = count($array_selected) + 1; // We tag the key $field as "selected" + // We check if there is a dependency to activate + /*var_dump($field); var_dump($fieldsentitiesarray[$field]); var_dump($fieldsdependenciesarray);*/ - $listofdependencies = array(); - if (!empty($fieldsentitiesarray[$field]) && !empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]])) - { - // We found a dependency on the type of field - $tmp = $fieldsdependenciesarray[$fieldsentitiesarray[$field]]; // $fieldsdependenciesarray=array('element'=>'fd.rowid') or array('element'=>array('fd.rowid','ab.rowid')) - if (is_array($tmp)) $listofdependencies = $tmp; - else $listofdependencies = array($tmp); - } elseif (!empty($field) && !empty($fieldsdependenciesarray[$field])) - { - // We found a dependency on a dedicated field - $tmp = $fieldsdependenciesarray[$field]; // $fieldsdependenciesarray=array('fd.fieldx'=>'fd.rowid') or array('fd.fieldx'=>array('fd.rowid','ab.rowid')) - if (is_array($tmp)) $listofdependencies = $tmp; - else $listofdependencies = array($tmp); - } - - if (count($listofdependencies)) - { - foreach ($listofdependencies as $fieldid) - { - if (empty($array_selected[$fieldid])) - { - $array_selected[$fieldid] = count($array_selected) + 1; // We tag the key $fieldid as "selected" - $warnings[] = $langs->trans("ExportFieldAutomaticallyAdded", $langs->transnoentitiesnoconv($fieldsarray[$fieldid])); - } - } - } - //print_r($array_selected); - $_SESSION["export_selected_fields"] = $array_selected; - - setEventMessages($warnings, null, 'warnings'); - } + $listofdependencies = array(); + if (!empty($fieldsentitiesarray[$field]) && !empty($fieldsdependenciesarray[$fieldsentitiesarray[$field]])) + { + // We found a dependency on the type of field + $tmp = $fieldsdependenciesarray[$fieldsentitiesarray[$field]]; // $fieldsdependenciesarray=array('element'=>'fd.rowid') or array('element'=>array('fd.rowid','ab.rowid')) + if (is_array($tmp)) $listofdependencies = $tmp; + else $listofdependencies = array($tmp); + } + elseif (!empty($field) && !empty($fieldsdependenciesarray[$field])) + { + // We found a dependency on a dedicated field + $tmp = $fieldsdependenciesarray[$field]; // $fieldsdependenciesarray=array('fd.fieldx'=>'fd.rowid') or array('fd.fieldx'=>array('fd.rowid','ab.rowid')) + if (is_array($tmp)) $listofdependencies = $tmp; + else $listofdependencies = array($tmp); + } + + if (count($listofdependencies)) + { + foreach ($listofdependencies as $fieldid) + { + if (empty($array_selected[$fieldid])) + { + $array_selected[$fieldid] = count($array_selected) + 1; // We tag the key $fieldid as "selected" + $warnings[] = $langs->trans("ExportFieldAutomaticallyAdded", $langs->transnoentitiesnoconv($fieldsarray[$fieldid])); + } + } + } + //print_r($array_selected); + $_SESSION["export_selected_fields"] = $array_selected; + + setEventMessages($warnings, null, 'warnings'); + } } if ($action == 'unselectfield') { - if ($_GET["field"] == 'all') - { + if ($_GET["field"] == 'all') + { $array_selected = array(); $_SESSION["export_selected_fields"] = $array_selected; - } else { - unset($array_selected[$_GET["field"]]); - // Renumber fields of array_selected (from 1 to nb_elements) - asort($array_selected); - $i = 0; - $array_selected_save = $array_selected; - foreach ($array_selected as $code=>$value) - { - $i++; - $array_selected[$code] = $i; - //print "x $code x $i y
"; - } - $_SESSION["export_selected_fields"] = $array_selected; - } + } + else + { + unset($array_selected[$_GET["field"]]); + // Renumber fields of array_selected (from 1 to nb_elements) + asort($array_selected); + $i = 0; + $array_selected_save = $array_selected; + foreach ($array_selected as $code=>$value) + { + $i++; + $array_selected[$code] = $i; + //print "x $code x $i y
"; + } + $_SESSION["export_selected_fields"] = $array_selected; + } } if ($action == 'downfield' || $action == 'upfield') { - $pos = $array_selected[$_GET["field"]]; - if ($action == 'downfield') $newpos = $pos + 1; - if ($action == 'upfield') $newpos = $pos - 1; - // Recherche code avec qui switcher - $newcode = ""; - foreach ($array_selected as $code=>$value) - { - if ($value == $newpos) - { - $newcode = $code; - break; - } - } - //print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)"); - if ($newcode) // Si newcode trouve (protection contre resoumission de page) - { - $array_selected[$_GET["field"]] = $newpos; - $array_selected[$newcode] = $pos; - $_SESSION["export_selected_fields"] = $array_selected; - } + $pos = $array_selected[$_GET["field"]]; + if ($action == 'downfield') $newpos = $pos + 1; + if ($action == 'upfield') $newpos = $pos - 1; + // Recherche code avec qui switcher + $newcode = ""; + foreach ($array_selected as $code=>$value) + { + if ($value == $newpos) + { + $newcode = $code; + break; + } + } + //print("Switch pos=$pos (code=".$_GET["field"].") and newpos=$newpos (code=$newcode)"); + if ($newcode) // Si newcode trouve (protection contre resoumission de page) + { + $array_selected[$_GET["field"]] = $newpos; + $array_selected[$newcode] = $pos; + $_SESSION["export_selected_fields"] = $array_selected; + } } if ($step == 1 || $action == 'cleanselect') { - $_SESSION["export_selected_fields"] = array(); - $_SESSION["export_filtered_fields"] = array(); - $array_selected = array(); - $array_filtervalue = array(); + $_SESSION["export_selected_fields"] = array(); + $_SESSION["export_filtered_fields"] = array(); + $array_selected = array(); + $array_filtervalue = array(); } if ($action == 'builddoc') { - $max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined - $max_time = @ini_get("max_execution_time"); - if ($max_time && $max_time < $max_execution_time_for_importexport) - { - dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); - @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 - } - - // Build export file + $max_execution_time_for_export = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_export) + { + @ini_set("max_execution_time", $max_execution_time_for_export); // This work only if safe mode is off. also web servers has timeout of 300 + } + + // Build export file $result = $objexport->build_file($user, GETPOST('model', 'alpha'), $datatoexport, $array_selected, $array_filtervalue); if ($result < 0) { setEventMessages($objexport->error, $objexport->errors, 'errors'); $sqlusedforexport = $objexport->sqlusedforexport; - } else { + } + else + { setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs'); - $sqlusedforexport = $objexport->sqlusedforexport; - } + $sqlusedforexport = $objexport->sqlusedforexport; + } } // Delete file @@ -304,9 +309,9 @@ if ($action == 'deleteprof') { - if (GETPOST("id", 'int')) + if ($_GET["id"]) { - $objexport->fetch(GETPOST('id', 'int')); + $objexport->fetch($_GET["id"]); $result = $objexport->delete($user); } } @@ -336,22 +341,27 @@ } } - $objexport->model_name = $export_name; - $objexport->datatoexport = $datatoexport; - $objexport->hexa = $hexa; - $objexport->hexafiltervalue = $hexafiltervalue; - - $result = $objexport->create($user); + $objexport->model_name = $export_name; + $objexport->datatoexport = $datatoexport; + $objexport->hexa = $hexa; + $objexport->hexafiltervalue = $hexafiltervalue; + + $result = $objexport->create($user); if ($result >= 0) { setEventMessages($langs->trans("ExportModelSaved", $objexport->model_name), null, 'mesgs'); - } else { + } + else + { $langs->load("errors"); if ($objexport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') setEventMessages($langs->trans("ErrorExportDuplicateProfil"), null, 'errors'); - else setEventMessages($objexport->error, $objexport->errors, 'errors'); - } - } else { + else + setEventMessages($objexport->error, $objexport->errors, 'errors'); + } + } + else + { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportModelName")), null, 'errors'); } } @@ -359,15 +369,15 @@ // Reload a predefined export model if ($step == 2 && $action == 'select_model') { - $_SESSION["export_selected_fields"] = array(); - $_SESSION["export_filtered_fields"] = array(); - - $array_selected = array(); - $array_filtervalue = array(); - - $result = $objexport->fetch($exportmodelid); - if ($result > 0) - { + $_SESSION["export_selected_fields"] = array(); + $_SESSION["export_filtered_fields"] = array(); + + $array_selected = array(); + $array_filtervalue = array(); + + $result = $objexport->fetch($exportmodelid); + if ($result > 0) + { $fieldsarray = preg_split("/,(?! [^(]*\))/", $objexport->hexa); $i = 1; foreach ($fieldsarray as $val) @@ -386,7 +396,7 @@ $i++; } $_SESSION["export_filtered_fields"] = $array_filtervalue; - } + } } // Get form with filters @@ -421,142 +431,148 @@ if ($step == 1 || !$datatoexport) { - llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); - - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; - $head[$h][1] = $langs->trans("Step")." 1"; - $hselected = $h; - $h++; - - print dol_get_fiche_head($head, $hselected, '', -1); - - print '
'.$langs->trans("SelectExportDataSet").'

'; - - // Affiche les modules d'exports - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - if (count($objexport->array_export_module)) - { - asort($objexport->array_export_code_for_sort); - //var_dump($objexport->array_export_code_for_sort); - //$sortedarrayofmodules = dol_sort_array($objexport->array_export_module, 'module_position', 'asc', 0, 0, 1); - foreach ($objexport->array_export_code_for_sort as $key => $value) - { - print ''; + } + } + else + { + print ''; + } + print '
'.$langs->trans("Module").''.$langs->trans("ExportableDatas").' 
'; - //print img_object($objexport->array_export_module[$key]->getName(),$export->array_export_module[$key]->picto).' '; - print $objexport->array_export_module[$key]->getName(); - print ''; - $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[$key]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); + llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); + + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; + $head[$h][1] = $langs->trans("Step")." 1"; + $hselected = $h; + $h++; + + dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -1); + + + print '
'.$langs->trans("SelectExportDataSet").'

'; + + // Affiche les modules d'exports + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if (count($objexport->array_export_module)) + { + $sortedarrayofmodules = dol_sort_array($objexport->array_export_module, 'module_position', 'asc', 0, 0, 1); + foreach ($sortedarrayofmodules as $key => $value) + { + print ''; - } - } else { - print ''; - } - print '
'.$langs->trans("Module").''.$langs->trans("ExportableDatas").' 
'; + //print img_object($objexport->array_export_module[$key]->getName(),$export->array_export_module[$key]->picto).' '; + print $objexport->array_export_module[$key]->getName(); + print ''; + $icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[$key]); $label = $objexport->array_export_label[$key]; - //print $value.'-'.$icon.'-'.$label."
"; - print img_object($objexport->array_export_module[$key]->getName(), $entityicon).' '; - print $label; - print '
'; - if ($objexport->array_export_perms[$key]) { - print ''.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15x"').''; - } else { - print $langs->trans("NotEnoughPermissions"); - } - print '
'.$langs->trans("NoExportableData").'
'; - print '
'; - - print ''; + //print $value.'-'.$icon.'-'.$label."
"; + print img_object($objexport->array_export_module[$key]->getName(), $icon).' '; + print $label; + print '
'; + if ($objexport->array_export_perms[$key]) + { + print ''.img_picto($langs->trans("NewExport"), 'filenew').''; + } + else + { + print $langs->trans("NotEnoughPermissions"); + } + print '
'.$langs->trans("NoExportableData").'
'; + print '
'; + + print ''; } if ($step == 2 && $datatoexport) { - llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); - - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; - $head[$h][1] = $langs->trans("Step")." 1"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." 2"; - $hselected = $h; - $h++; - - print dol_get_fiche_head($head, $hselected, '', -2); - - print '
'; - print '
'; - - print ''; - - // Module - print ''; - print ''; + llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); + + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; + $head[$h][1] = $langs->trans("Step")." 1"; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." 2"; + $hselected = $h; + $h++; + + dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -2); + + print '
'; + print '
'; + + print '
'.$langs->trans("Module").''; - print $objexport->array_export_module[0]->getName(); - print '
'; + + // Module + print ''; + print ''; // Lot de donnees a exporter print ''; print ''; - print '
'.$langs->trans("Module").''; + //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' '; + print $objexport->array_export_module[0]->getName(); + print '
'.$langs->trans("DatasetToExport").''; - $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); - print img_object($objexport->array_export_module[0]->getName(), $entityicon).' '; - print $objexport->array_export_label[0]; + $icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); + $label = $objexport->array_export_label[0]; + //print $value.'-'.$icon.'-'.$label."
"; + print img_object($objexport->array_export_module[0]->getName(), $icon).' '; + print $label; print '
'; - print '
'; - - print dol_get_fiche_end(); - - print '
'; - - // Combo list of export models - print '
'; - print ''; - print ''; - print ''; - print ''; - print '
'; - print ''.$langs->trans("SelectExportFields").' '; - if (empty($conf->global->EXPORTS_SHARE_MODELS)) { - $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1, $user->id); - } else { - $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1); - } - print ' '; - print ''; - print '
'; - print '
'; - - - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - print ''; + print '
'; + print '
'; + + dol_fiche_end(); + + print '
'; + + // Combo list of export models + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + print ''.$langs->trans("SelectExportFields").' '; + if (empty($conf->global->EXPORTS_SHARE_MODELS)) { + $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1, $user->id); + } + else { + $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1); + } + print ' '; + print ''; + print '
'; + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print ''; + print ''; print ''; - print ''; - print ''; - print ''; - print ''; - - // Champs exportables - $fieldsarray = $objexport->array_export_fields[0]; - // Select request if all fields are selected - $sqlmaxforexport = $objexport->build_sql(0, array(), array()); + print ''; + print ''; + print ''; + print ''; + + // Champs exportables + $fieldsarray = $objexport->array_export_fields[0]; + // Select request if all fields are selected + $sqlmaxforexport = $objexport->build_sql(0, array(), array()); // $this->array_export_module[0]=$module; // $this->array_export_code[0]=$module->export_code[$r]; @@ -566,48 +582,50 @@ // $this->array_export_entities[0]=$module->export_fields_entities[$r]; // $this->array_export_alias[0]=$module->export_fields_alias[$r]; - $i = 0; - - foreach ($fieldsarray as $code=>$label) - { - print ''; - - $i++; - - $entity = (!empty($objexport->array_export_entities[0][$code]) ? $objexport->array_export_entities[0][$code] : $objexport->array_export_icon[0]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); - $entitylang = (!empty($entitytolang[$entity]) ? $entitytolang[$entity] : $entity); - - print ''; - - $text = (empty($objexport->array_export_special[0][$code]) ? '' : '').$langs->trans($label).(empty($objexport->array_export_special[0][$code]) ? '' : ''); - - $tablename = getablenamefromfield($code, $sqlmaxforexport); - $htmltext = ''.$langs->trans("Name").": ".$text.'
'; - if (!empty($objexport->array_export_special[0][$code])) - { - $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; - } else { - $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; - } + $i = 0; + + foreach ($fieldsarray as $code=>$label) + { + print ''; + + $i++; + + $entity = (!empty($objexport->array_export_entities[0][$code]) ? $objexport->array_export_entities[0][$code] : $objexport->array_export_icon[0]); + $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); + $entitylang = (!empty($entitytolang[$entity]) ? $entitytolang[$entity] : $entity); + + print ''; + + $text = (empty($objexport->array_export_special[0][$code]) ? '' : '').$langs->trans($label).(empty($objexport->array_export_special[0][$code]) ? '' : ''); + + $tablename = getablenamefromfield($code, $sqlmaxforexport); + $htmltext = ''.$langs->trans("Name").": ".$text.'
'; + if (!empty($objexport->array_export_special[0][$code])) + { + $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; + } + else + { + $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; + } if (!empty($objexport->array_export_examplevalues[0][$code])) { - $htmltext .= ''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; - } - if (!empty($objexport->array_export_TypeFields[0][$code])) - { - $htmltext .= ''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; + $htmltext .= ''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; + } + if (!empty($objexport->array_export_TypeFields[0][$code])) + { + $htmltext .= ''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; } if (!empty($objexport->array_export_help[0][$code])) { @@ -615,63 +633,69 @@ } if (isset($array_selected[$code]) && $array_selected[$code]) - { - // Selected fields - print ''; - print ''; - print ''; + print ''; + print ''; + } + else + { + // Fields not selected + print ''; - } else { - // Fields not selected - print ''; - print ''; - print ''; - } - - print ''; - } - - print '
'.$langs->trans("Entities").''.$langs->trans("ExportableFields").''; - print ''.$langs->trans("All").""; - print ' / '; - print ''.$langs->trans("None").""; - print ''.$langs->trans("ExportedFields").'
'.$langs->trans("ExportableFields").''; + print ''.$langs->trans("All").""; + print ' / '; + print ''.$langs->trans("None").""; + print ''.$langs->trans("ExportedFields").'
'; - // If value of entityicon=entitylang='icon:Label' - //print $code.'-'.$label.'-'.$entity; - - $tmparray = explode(':', $entityicon); - if (count($tmparray) >= 2) - { - $entityicon = $tmparray[0]; - $entitylang = $tmparray[1]; - } - print img_object('', $entityicon).' '.$langs->trans($entitylang); - print '
'; + // If value of entityicon=entitylang='icon:Label' + //print $code.'-'.$label.'-'.$entity; + + $tmparray = explode(':', $entityicon); + if (count($tmparray) >= 2) + { + $entityicon = $tmparray[0]; + $entitylang = $tmparray[1]; + } + print img_object('', $entityicon).' '.$langs->trans($entitylang); + print ' '.img_left('default', 0, 'style="max-width: 20px"').''; + { + // Selected fields + print ' '.img_left('default', 0, 'style="max-width: 20px"').''; + //print $text.'-'.$htmltext."
"; + print $form->textwithpicto($text, $htmltext); + //print ' ('.$code.')'; + print '
'; //print $text.'-'.$htmltext."
"; print $form->textwithpicto($text, $htmltext); //print ' ('.$code.')'; - print '
'; - //print $text.'-'.$htmltext."
"; - print $form->textwithpicto($text, $htmltext); - //print ' ('.$code.')'; - print '
'.img_right('default', 0, 'style="max-width: 20px"').' 
'; - print '
'; - - /* + print ''; + print ''.img_right('default', 0, 'style="max-width: 20px"').''; + print ' '; + } + + print ''; + } + + print ''; + print ''; + + /* * Barre d'action */ - print '
'; - - if (count($array_selected)) + print '
'; + + if (count($array_selected)) { // If filters exist if ($usefilters && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) { print ''.$langs->trans("NextStep").''; - } else { + } + else + { print ''.$langs->trans("NextStep").''; } - } else { + } + else + { print ''.$langs->trans("NextStep").''; } - print '
'; + print '
'; } if ($step == 3 && $datatoexport) { - if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired - { - // Switch to step 2 - header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); - exit; - } - - llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); + if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired + { + // Switch to step 2 + header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); + exit; + } + + llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); $h = 0; @@ -688,10 +712,10 @@ $hselected = $h; $h++; - print dol_get_fiche_head($head, $hselected, '', -2); - - print '
'; - print '
'; + dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -2); + + print '
'; + print '
'; print ''; // Module @@ -704,10 +728,11 @@ // Lot de donnees a exporter print ''; print ''; // Nbre champs exportes @@ -735,7 +760,7 @@ print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print '
'.$langs->trans("DatasetToExport").''; - $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); - print img_object($objexport->array_export_module[0]->getName(), $entityicon).' '; - print $objexport->array_export_label[0]; + $icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); + $label = $objexport->array_export_label[0]; + //print $value.'-'.$icon.'-'.$label."
"; + print img_object($objexport->array_export_module[0]->getName(), $icon).' '; + print $label; print '
'; + print '
'; print ''; print ''; //print ''; @@ -782,19 +807,21 @@ $tablename = getablenamefromfield($code, $sqlmaxforexport); $htmltext = ''.$langs->trans("Name").': '.$text.'
'; - if (!empty($objexport->array_export_special[0][$code])) - { - $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; - } else { - $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; + if (!empty($objexport->array_export_special[0][$code])) + { + $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; + } + else + { + $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; } if (!empty($objexport->array_export_examplevalues[0][$code])) { - $htmltext .= ''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; + $htmltext .= ''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; } if (!empty($objexport->array_export_TypeFields[0][$code])) { - $htmltext .= ''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; + $htmltext .= ''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; } if (!empty($objexport->array_export_help[0][$code])) { @@ -814,7 +841,9 @@ { $tmp = $objexport->build_filterField($Typefieldsarray[$code], $code, $ValueFilter); print $form->textwithpicto($tmp, $szInfoFiltre); - } else { + } + else + { print $objexport->build_filterField($Typefieldsarray[$code], $code, $ValueFilter); } } @@ -824,7 +853,7 @@ } print '
'.$langs->trans("Entities").''.$langs->trans("ExportableFields").'
'; - print '
'; + print '
'; print ''; @@ -839,215 +868,216 @@ if ($step == 4 && $datatoexport) { - if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired - { - // Switch to step 2 - header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); - exit; - } - - asort($array_selected); - - llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); - - $stepoffset = 0; - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; - $head[$h][1] = $langs->trans("Step")." 1"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." 2"; - $h++; - - // If filters exist - if ($usefilters && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) - { - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." 3"; - $h++; - $stepoffset++; - } - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." ".(3 + $stepoffset); - $hselected = $h; - $h++; - - print dol_get_fiche_head($head, $hselected, '', -2); - - print '
'; - print '
'; - print ''; - - // Module - print ''; - print ''; + if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired + { + // Switch to step 2 + header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); + exit; + } + + asort($array_selected); + + llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); + + $stepoffset = 0; + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; + $head[$h][1] = $langs->trans("Step")." 1"; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." 2"; + $h++; + + // If filters exist + if ($usefilters && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) + { + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." 3"; + $h++; + $stepoffset++; + } + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." ".(3 + $stepoffset); + $hselected = $h; + $h++; + + dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -2); + + print '
'; + print '
'; + print '
'.$langs->trans("Module").''; - //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' '; - print $objexport->array_export_module[0]->getName(); - print '
'; + + // Module + print ''; + print ''; // Lot de donnees a exporter print ''; print ''; - // List of exported fields - print ''; - $list = ''; - foreach ($array_selected as $code=>$value) - { - $list .= (!empty($list) ? ', ' : ''); - $list .= $langs->trans($objexport->array_export_fields[0][$code]); - } - print ''; - print ''; - - // List of filtered fiels - if (isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) - { - print ''; - $list = ''; - if (!empty($array_filtervalue)) - { - foreach ($array_filtervalue as $code=>$value) - { - if (isset($objexport->array_export_fields[0][$code])) - { - $list .= ($list ? ', ' : ''); - if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) $list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); - else $list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; - } - } - } - print ''; - print ''; - } - - print '
'.$langs->trans("Module").''; + //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' '; + print $objexport->array_export_module[0]->getName(); + print '
'.$langs->trans("DatasetToExport").''; - $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); - print img_object($objexport->array_export_module[0]->getName(), $entityicon).' '; + $icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); + print img_object($objexport->array_export_module[0]->getName(), $icon).' '; print $objexport->array_export_label[0]; print '
'.$langs->trans("ExportedFields").''.$list.'
'.$langs->trans("FilteredFields").''.(!empty($list) ? $list : ''.$langs->trans("None").'').'
'; - print '
'; - - print '
'; - - // Select request if all fields are selected - $sqlmaxforexport = $objexport->build_sql(0, array(), array()); - - print '
'.$langs->trans("ChooseFieldsOrdersAndTitle").'
'; - - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - //print ''; - print ''; - - foreach ($array_selected as $code=>$value) - { - print ''; - - $entity = (!empty($objexport->array_export_entities[0][$code]) ? $objexport->array_export_entities[0][$code] : $objexport->array_export_icon[0]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); - $entitylang = (!empty($entitytolang[$entity]) ? $entitytolang[$entity] : $entity); - - print ''; - - $labelName = $objexport->array_export_fields[0][$code]; + // List of exported fields + print ''; + $list = ''; + foreach ($array_selected as $code=>$value) + { + $list .= (!empty($list) ? ', ' : ''); + $list .= $langs->trans($objexport->array_export_fields[0][$code]); + } + print ''; + print ''; + + // List of filtered fiels + if (isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) + { + print ''; + $list = ''; + if (!empty($array_filtervalue)) + { + foreach ($array_filtervalue as $code=>$value) + { + if (isset($objexport->array_export_fields[0][$code])) + { + $list .= ($list ? ', ' : ''); + if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) $list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); + else $list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; + } + } + } + print ''; + print ''; + } + + print '
'.$langs->trans("Entities").''.$langs->trans("ExportedFields").''.$langs->trans("Position").' '.$langs->trans("FieldsTitle").'
'; - // If value of entityicon=entitylang='icon:Label' - $tmparray = explode(':', $entityicon); - if (count($tmparray) >= 2) - { - $entityicon = $tmparray[0]; - $entitylang = $tmparray[1]; - } - print img_object('', $entityicon).' '.$langs->trans($entitylang); - print '
'.$langs->trans("ExportedFields").''.$list.'
'.$langs->trans("FilteredFields").''.(!empty($list) ? $list : ''.$langs->trans("None").'').'
'; + print '
'; + + print '
'; + + // Select request if all fields are selected + $sqlmaxforexport = $objexport->build_sql(0, array(), array()); + + print '
'.$langs->trans("ChooseFieldsOrdersAndTitle").'
'; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + //print ''; + print ''; + + foreach ($array_selected as $code=>$value) + { + print ''; + + $entity = (!empty($objexport->array_export_entities[0][$code]) ? $objexport->array_export_entities[0][$code] : $objexport->array_export_icon[0]); + $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); + $entitylang = (!empty($entitytolang[$entity]) ? $entitytolang[$entity] : $entity); + + print ''; + + $labelName = $objexport->array_export_fields[0][$code]; $text = (empty($objexport->array_export_special[0][$code]) ? '' : '').$langs->trans($labelName).(empty($objexport->array_export_special[0][$code]) ? '' : ''); - $tablename = getablenamefromfield($code, $sqlmaxforexport); - $htmltext = ''.$langs->trans("Name").': '.$text.'
'; - if (!empty($objexport->array_export_special[0][$code])) - { - $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; - } else { - $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; - } - if (!empty($objexport->array_export_examplevalues[0][$code])) - { - $htmltext .= ''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; - } - if (!empty($objexport->array_export_TypeFields[0][$code])) - { - $htmltext .= ''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; - } - if (!empty($objexport->array_export_help[0][$code])) - { - $htmltext .= ''.$langs->trans("Help").': '.$langs->trans($objexport->array_export_help[0][$code]).'
'; - } - - print ''; - - print ''; - - //print ''; - //print ''; - - print ''; - } - - print '
'.$langs->trans("Entities").''.$langs->trans("ExportedFields").''.$langs->trans("Position").' '.$langs->trans("FieldsTitle").'
'; + // If value of entityicon=entitylang='icon:Label' + $tmparray = explode(':', $entityicon); + if (count($tmparray) >= 2) + { + $entityicon = $tmparray[0]; + $entitylang = $tmparray[1]; + } + print img_object('', $entityicon).' '.$langs->trans($entitylang); + print ''; - print $form->textwithpicto($text, $htmltext); + $tablename = getablenamefromfield($code, $sqlmaxforexport); + $htmltext = ''.$langs->trans("Name").': '.$text.'
'; + if (!empty($objexport->array_export_special[0][$code])) + { + $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; + } + else + { + $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; + } + if (!empty($objexport->array_export_examplevalues[0][$code])) + { + $htmltext .= ''.$langs->trans("SourceExample").': '.$objexport->array_export_examplevalues[0][$code].'
'; + } + if (!empty($objexport->array_export_TypeFields[0][$code])) + { + $htmltext .= ''.$langs->trans("Type").': '.$objexport->array_export_TypeFields[0][$code].'
'; + } + if (!empty($objexport->array_export_help[0][$code])) + { + $htmltext .= ''.$langs->trans("Help").': '.$langs->trans($objexport->array_export_help[0][$code]).'
'; + } + + print '
'; + print $form->textwithpicto($text, $htmltext); //print ' ('.$code.')'; - print ''; - print $value.' '; - print ''; - if ($value < count($array_selected)) print ''.img_down().''; - if ($value > 1) print ''.img_up().''; - print ' '.$langs->trans($objexport->array_export_fields[0][$code]).'
'; - print '
'; - - print ''; - - /* + print ''; + + print ''; + print $value.' '; + print ''; + if ($value < count($array_selected)) print ''.img_down().''; + if ($value > 1) print ''.img_up().''; + print ''; + + //print ' '; + //print ''.$langs->trans($objexport->array_export_fields[0][$code]).''; + + print ''; + } + + print ''; + print ''; + + print ''; + + /* * Barre d'action * */ - print '
'; - - if (count($array_selected)) - { - print ''.$langs->trans("NextStep").''; - } - - print '
'; + print '
'; + + if (count($array_selected)) + { + print ''.$langs->trans("NextStep").''; + } + + print '
'; // Area for profils export if (count($array_selected)) - { + { print '
'; print '
'; - print ''.$langs->trans("SaveExportModel").''; - print '
'; + print ''.$langs->trans("SaveExportModel").''; + print ''; print '
'; print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; print ''; print ''; print ''; @@ -1055,13 +1085,13 @@ print ''; print ''; - - // List of existing export profils - $sql = "SELECT rowid, label"; + print ''; + print ''; + + // List of existing export profils + $sql = "SELECT rowid, label"; $sql .= " FROM ".MAIN_DB_PREFIX."export_model"; - $sql .= " WHERE type = '".$db->escape($datatoexport)."'"; + $sql .= " WHERE type = '".$datatoexport."'"; if (empty($conf->global->EXPORTS_SHARE_MODELS))$sql .= " AND fk_user=".$user->id; $sql .= " ORDER BY rowid"; $resql = $db->query($sql); @@ -1075,179 +1105,179 @@ print ''; $i++; } - } else { - dol_print_error($db); - } - - print '
'.$langs->trans("ExportModelName").' 
'; - print ''; - print '
'; print $obj->label; print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; print '
'; - print '
'; - - print '
'; - } + } + else { + dol_print_error($this->db); + } + + print ''; + print ''; + + print ''; + } } if ($step == 5 && $datatoexport) { - if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired - { - // Switch to step 2 - header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); - exit; - } + if (count($array_selected) < 1) // This occurs when going back to page after sessecion expired + { + // Switch to step 2 + header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport); + exit; + } asort($array_selected); - llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); - - $h = 0; - $stepoffset = 0; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; - $head[$h][1] = $langs->trans("Step")." 1"; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." 2"; - $h++; - - // si le filtrage est parametre pour l'export ou pas - if ($usefilters && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) - { - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." 3"; - $h++; - $stepoffset++; - } - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." ".(3 + $stepoffset); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=5&datatoexport='.$datatoexport; - $head[$h][1] = $langs->trans("Step")." ".(4 + $stepoffset); - $hselected = $h; - $h++; - - print dol_get_fiche_head($head, $hselected, '', -2); - - /* + llxHeader('', $langs->trans("NewExport"), 'EN:Module_Exports_En|FR:Module_Exports|ES:Módulo_Exportaciones'); + + $h = 0; + $stepoffset = 0; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=1'; + $head[$h][1] = $langs->trans("Step")." 1"; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." 2"; + $h++; + + // si le filtrage est parametre pour l'export ou pas + if ($usefilters && isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) + { + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=3&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." 3"; + $h++; + $stepoffset++; + } + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=4&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." ".(3 + $stepoffset); + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/exports/export.php?step=5&datatoexport='.$datatoexport; + $head[$h][1] = $langs->trans("Step")." ".(4 + $stepoffset); + $hselected = $h; + $h++; + + dol_fiche_head($head, $hselected, $langs->trans("NewExport"), -2); + + /* * Confirmation suppression fichier */ - if ($action == 'remove_file') - { - print $form->formconfirm($_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport.'&file='.urlencode(GETPOST("file")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - } - - print '
'; - print '
'; - - print ''; - - // Module - print ''; - print ''; + if ($action == 'remove_file') + { + print $form->formconfirm($_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport.'&file='.urlencode(GETPOST("file")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } + + print '
'; + print '
'; + + print '
'.$langs->trans("Module").''; - //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' '; - print $objexport->array_export_module[0]->getName(); - print '
'; + + // Module + print ''; + print ''; // Dataset to export print ''; print ''; - // List of exported fields - print ''; - $list = ''; - foreach ($array_selected as $code=>$label) - { - $list .= (!empty($list) ? ', ' : ''); - $list .= $langs->trans($objexport->array_export_fields[0][$code]); - } - print ''; - - // List of filtered fields - if (isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) - { - print ''; - $list = ''; - if (!empty($array_filtervalue)) - { - foreach ($array_filtervalue as $code=>$value) - { - if (isset($objexport->array_export_fields[0][$code])) - { - $list .= ($list ? ', ' : ''); - if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) $list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); - else $list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; - } - } - } - print ''; - print ''; - } - - print '
'.$langs->trans("Module").''; + //print img_object($objexport->array_export_module[0]->getName(),$objexport->array_export_module[0]->picto).' '; + print $objexport->array_export_module[0]->getName(); + print '
'.$langs->trans("DatasetToExport").''; - $entity = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); - $entityicon = strtolower(!empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity); - print img_object($objexport->array_export_module[0]->getName(), $entityicon).' '; + $icon = preg_replace('/:.*$/', '', $objexport->array_export_icon[0]); + print img_object($objexport->array_export_module[0]->getName(), $icon).' '; print $objexport->array_export_label[0]; print '
'.$langs->trans("ExportedFields").''.$list.'
'.$langs->trans("FilteredFields").''.(!empty($list) ? $list : ''.$langs->trans("None").'').'
'; - print '
'; - - print '
'; - - // List of available export formats - $htmltabloflibs = ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''."\n"; - - $liste = $objmodelexport->liste_modeles($db); - $listeall = $liste; - foreach ($listeall as $key => $val) - { - if (preg_match('/__\(Disabled\)__/', $listeall[$key])) - { - $listeall[$key] = preg_replace('/__\(Disabled\)__/', '('.$langs->transnoentitiesnoconv("Disabled").')', $listeall[$key]); - unset($liste[$key]); - } - - $htmltabloflibs .= ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''; - $htmltabloflibs .= ''."\n"; - } - $htmltabloflibs .= '
'.$langs->trans("AvailableFormats").''.$langs->trans("LibraryUsed").''.$langs->trans("LibraryVersion").'
'.img_picto_common($key, $objmodelexport->getPictoForKey($key)).' '; - $text = $objmodelexport->getDriverDescForKey($key); - $label = $listeall[$key]; - $htmltabloflibs .= $form->textwithpicto($label, $text).''.$objmodelexport->getLibLabelForKey($key).''.$objmodelexport->getLibVersionForKey($key).'
'; - - print ''.$form->textwithpicto($langs->trans("NowClickToGenerateToBuildExportFile"), $htmltabloflibs, 1, 'help', '', 0, 2, 'helphonformat').''; - //print $htmltabloflibs; - print '
'; - - print ''; - - - if ($sqlusedforexport && $user->admin) - { - print info_admin($langs->trans("SQLUsedForExport").':
'.$sqlusedforexport, 0, 0, 1, '', 'TechnicalInformation'); - } - - - if (!is_dir($conf->export->dir_temp)) dol_mkdir($conf->export->dir_temp); - - // Show existing generated documents - // NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste - print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (!empty($_POST['model']) ? $_POST['model'] : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', ''); + // List of exported fields + print ''.$langs->trans("ExportedFields").''; + $list = ''; + foreach ($array_selected as $code=>$label) + { + $list .= (!empty($list) ? ', ' : ''); + $list .= $langs->trans($objexport->array_export_fields[0][$code]); + } + print ''.$list.''; + + // List of filtered fields + if (isset($objexport->array_export_TypeFields[0]) && is_array($objexport->array_export_TypeFields[0])) + { + print ''.$langs->trans("FilteredFields").''; + $list = ''; + if (!empty($array_filtervalue)) + { + foreach ($array_filtervalue as $code=>$value) + { + if (isset($objexport->array_export_fields[0][$code])) + { + $list .= ($list ? ', ' : ''); + if (isset($array_filtervalue[$code]) && preg_match('/^\s*[<>]/', $array_filtervalue[$code])) $list .= $langs->trans($objexport->array_export_fields[0][$code]).(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : ''); + else $list .= $langs->trans($objexport->array_export_fields[0][$code])."='".(isset($array_filtervalue[$code]) ? $array_filtervalue[$code] : '')."'"; + } + } + } + print ''.(!empty($list) ? $list : ''.$langs->trans("None").'').''; + print ''; + } + + print ''; + print ''; + + print '
'; + + // List of available export formats + $htmltabloflibs = ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''."\n"; + + $liste = $objmodelexport->liste_modeles($db); + $listeall = $liste; + foreach ($listeall as $key => $val) + { + if (preg_match('/__\(Disabled\)__/', $listeall[$key])) + { + $listeall[$key] = preg_replace('/__\(Disabled\)__/', '('.$langs->transnoentitiesnoconv("Disabled").')', $listeall[$key]); + unset($liste[$key]); + } + + $htmltabloflibs .= ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''; + $htmltabloflibs .= ''."\n"; + } + $htmltabloflibs .= '
'.$langs->trans("AvailableFormats").''.$langs->trans("LibraryUsed").''.$langs->trans("LibraryVersion").'
'.img_picto_common($key, $objmodelexport->getPictoForKey($key)).' '; + $text = $objmodelexport->getDriverDescForKey($key); + $label = $listeall[$key]; + $htmltabloflibs .= $form->textwithpicto($label, $text).''.$objmodelexport->getLibLabelForKey($key).''.$objmodelexport->getLibVersionForKey($key).'
'; + + print ''.$form->textwithpicto($langs->trans("NowClickToGenerateToBuildExportFile"), $htmltabloflibs, 1, 'help', '', 0, 2, 'helphonformat').''; + //print $htmltabloflibs; + print '
'; + + print ''; + + + if ($sqlusedforexport && $user->admin) + { + print info_admin($langs->trans("SQLUsedForExport").':
'.$sqlusedforexport, 0, 0, 1, '', 'TechnicalInformation'); + } + + + if (!is_dir($conf->export->dir_temp)) dol_mkdir($conf->export->dir_temp); + + // Show existing generated documents + // NB: La fonction show_documents rescanne les modules qd genallowed=1, sinon prend $liste + print $formfile->showdocuments('export', '', $upload_dir, $_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport, $liste, 1, (!empty($_POST['model']) ? $_POST['model'] : 'csv'), 1, 1, 0, 0, 0, '', 'none', '', '', ''); } llxFooter(); @@ -1276,5 +1306,6 @@ if (preg_match($regexstring, $newsql, $reg)) { return $reg[1]; // The tablename - } else return ''; -} + } + else return ''; +} --- /tmp/dsg/dolibarr/htdocs/exports/github_index.php +++ /tmp/dsg/dolibarr/htdocs/exports/client_index.php @@ -50,7 +50,7 @@ print '
'; if (count($export->array_export_code)) { - print dolGetButtonTitle($langs->trans('NewExport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/exports/export.php?leftmenu=export', '', $user->rights->export->creer); + print dolGetButtonTitle($langs->trans('NewExport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/exports/export.php?leftmenu=export', '', $user->rights->export->creer); } print '
'; print '
'; @@ -73,10 +73,10 @@ foreach ($liste as $key => $val) { - if (preg_match('/__\(Disabled\)__/', $liste[$key])) - { - $liste[$key] = preg_replace('/__\(Disabled\)__/', '('.$langs->transnoentitiesnoconv("Disabled").')', $liste[$key]); - } + if (preg_match('/__\(Disabled\)__/', $liste[$key])) + { + $liste[$key] = preg_replace('/__\(Disabled\)__/', '('.$langs->transnoentitiesnoconv("Disabled").')', $liste[$key]); + } print ''; print ''.img_picto_common($model->getDriverLabelForKey($key), $model->getPictoForKey($key)).'';