diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 300d3a9d7f6..23d5a61415b 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -623,6 +623,17 @@ if ($step == 4 && $datatoimport) $obj->separator = $separator; $obj->enclosure = $enclosure; } + if ($model == 'xlsx') { + if (! preg_match('/\.xlsx$/i', $filetoimport)) + { + $langs->load("errors"); + $param='&datatoimport='.$datatoimport.'&format='.$format; + setEventMessages($langs->trans("ErrorFileMustHaveFormat", $model),null,'errors'); + header("Location: ".$_SERVER["PHP_SELF"].'?step=3'.$param.'&filetoimport='.urlencode($relativepath)); + exit; + } + + } // Load source fields in input file $fieldssource=array(); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 8b64c97ba34..bbbb9dbaddf 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -173,6 +173,7 @@ ErrorOppStatusRequiredIfAmount=You set an estimated amount for this opportunity/ ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu) ErrorSavingChanges=An error has ocurred when saving the changes ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship +ErrorFileMustHaveFormat=File must have format %s # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.