mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Adjustments for imports
This commit is contained in:
parent
1a000427fb
commit
d40da3c7f2
@ -162,12 +162,14 @@ class ImportController extends Controller
|
|||||||
$delimiters = [',', '.', ';'];
|
$delimiters = [',', '.', ';'];
|
||||||
$bestDelimiter = ' ';
|
$bestDelimiter = ' ';
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
foreach ($delimiters as $delimiter) {
|
foreach ($delimiters as $delimiter) {
|
||||||
|
|
||||||
if (substr_count(strstr($csvfile, "\n", true), $delimiter) >= $count) {
|
if (substr_count(strstr($csvfile, "\n", true), $delimiter) >= $count) {
|
||||||
$count = substr_count($csvfile, $delimiter);
|
$count = substr_count($csvfile, $delimiter);
|
||||||
$bestDelimiter = $delimiter;
|
$bestDelimiter = $delimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $bestDelimiter;
|
return $bestDelimiter;
|
||||||
}
|
}
|
||||||
|
@ -91,6 +91,10 @@ class BaseImport
|
|||||||
|
|
||||||
public function getCsvData($entity_type)
|
public function getCsvData($entity_type)
|
||||||
{
|
{
|
||||||
|
if (! ini_get('auto_detect_line_endings')) {
|
||||||
|
ini_set('auto_detect_line_endings', '1');
|
||||||
|
}
|
||||||
|
|
||||||
$base64_encoded_csv = Cache::pull($this->hash.'-'.$entity_type);
|
$base64_encoded_csv = Cache::pull($this->hash.'-'.$entity_type);
|
||||||
|
|
||||||
if (empty($base64_encoded_csv)) {
|
if (empty($base64_encoded_csv)) {
|
||||||
@ -132,14 +136,12 @@ class BaseImport
|
|||||||
$bestDelimiter = ',';
|
$bestDelimiter = ',';
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($delimiters as $delimiter) {
|
foreach ($delimiters as $delimiter) {
|
||||||
// if (substr_count($csvfile, $delimiter) > $count) {
|
|
||||||
// $count = substr_count($csvfile, $delimiter);
|
if (substr_count(strstr($csvfile, "\n", true), $delimiter) >= $count) {
|
||||||
// $bestDelimiter = $delimiter;
|
|
||||||
// }
|
|
||||||
if (substr_count(strstr($csvfile, "\n", true), $delimiter) > $count) {
|
|
||||||
$count = substr_count($csvfile, $delimiter);
|
$count = substr_count($csvfile, $delimiter);
|
||||||
$bestDelimiter = $delimiter;
|
$bestDelimiter = $delimiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return $bestDelimiter;
|
return $bestDelimiter;
|
||||||
}
|
}
|
||||||
|
@ -732,6 +732,9 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
$invoices_string = \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: null;
|
$invoices_string = \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: null;
|
||||||
|
|
||||||
|
if (!$invoices_string)
|
||||||
|
return str_replace(["*","<",">","'",'"'], "", $this->client->company->present()->name());
|
||||||
|
|
||||||
$invoices_string = str_replace(["*","<",">","'",'"'], "-", $invoices_string);
|
$invoices_string = str_replace(["*","<",">","'",'"'], "-", $invoices_string);
|
||||||
|
|
||||||
$invoices_string = "I-".$invoices_string;
|
$invoices_string = "I-".$invoices_string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user