mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 23:44:35 -04:00
Fixes for import hints
This commit is contained in:
parent
fa38433de9
commit
4fa57dfc59
@ -118,9 +118,36 @@ class ImportController extends Controller
|
||||
|
||||
})->toArray();
|
||||
|
||||
|
||||
//Exact string match
|
||||
foreach($headers as $key => $value) {
|
||||
|
||||
foreach($translated_keys as $tkey => $tvalue) {
|
||||
|
||||
$concat_needle = str_ireplace(" ", "", $tvalue['index'].$tvalue['label']);
|
||||
$concat_value = str_ireplace(" ", "", $value);
|
||||
|
||||
if($this->testMatch($concat_value, $concat_needle)) {
|
||||
|
||||
$hit = $tvalue['key'];
|
||||
$hints[$key] = $hit;
|
||||
unset($translated_keys[$tkey]);
|
||||
break;
|
||||
|
||||
} else {
|
||||
$hints[$key] = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Label Match
|
||||
foreach($headers as $key => $value) {
|
||||
|
||||
if(isset($hints[$key])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach($translated_keys as $tkey => $tvalue) {
|
||||
|
||||
if($this->testMatch($value, $tvalue['label'])) {
|
||||
@ -134,10 +161,9 @@ class ImportController extends Controller
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//second pass using the index of the translation here
|
||||
//Index matching pass using the index of the translation here
|
||||
foreach($headers as $key => $value) {
|
||||
if(isset($hints[$key])) {
|
||||
continue;
|
||||
|
@ -58,9 +58,8 @@ class CompanyRepository extends BaseRepository
|
||||
$company->smtp_password = $data['smtp_password'];
|
||||
}
|
||||
|
||||
if(isset($data['e_invoice'])){
|
||||
if(isset($data['e_invoice']) && is_array($data['e_invoice'])){
|
||||
//ensure it is normalized first!
|
||||
|
||||
$data['e_invoice'] = $this->arrayFilterRecursive($data['e_invoice']);
|
||||
|
||||
$company->e_invoice = $data['e_invoice'];
|
||||
|
@ -980,6 +980,7 @@ class TemplateService
|
||||
return [
|
||||
'name' => $user->present()->name(),
|
||||
'email' => $user->email,
|
||||
'signature' => $user->signature ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,9 @@ class HtmlEngine
|
||||
$data['$taxes'] = ['value' => Number::formatMoney($this->entity_calc->getItemTotalTaxes(), $this->client) ?: ' ', 'label' => ctrans('texts.taxes')];
|
||||
$data['$invoice.taxes'] = &$data['$taxes'];
|
||||
|
||||
|
||||
$data['$user.name'] = ['value' => $this->entity->user->present()->name(), 'label' => ctrans('texts.name')];
|
||||
$data['$user.signature'] = ['value' => $this->entity->user->signature ?? '', 'label' => ctrans('texts.signature')];
|
||||
$data['$user.first_name'] = ['value' => $this->entity->user->first_name, 'label' => ctrans('texts.first_name')];
|
||||
$data['$user.last_name'] = ['value' => $this->entity->user->last_name, 'label' => ctrans('texts.last_name')];
|
||||
$data['$created_by_user'] = &$data['$user.name'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user