Skip to content

fixed quantities on items import - #6

Merged
jekkos merged 1 commit into
opensourcepos:masterfrom
curthauta:import_items
Nov 20, 2014
Merged

jekkos merged 1 commit into
opensourcepos:masterfrom
curthauta:import_items

Conversation

@curthauta

Copy link
Copy Markdown
Contributor

I noticed that the csv import was still putting quantity into the items table, so I edited the item controller's do_excel_import() method to put the quantities into the item_quantities table.

I also edited the import_items.csv file, deleting the Quantity and Location columns, and adding two new columns: location_id and quantity.

You can add as many of these columns as you need. For instance, if you have two locations, you can add these columns:

location_id: 1
quantity: 100
location_id: 2
quantity: 200

@jekkos

jekkos commented Nov 20, 2014

Copy link
Copy Markdown
Member

I'm not sure if the quantity column is completely obsolete now in the items section. But I suppose this will fix the problem already.

jekkos added a commit that referenced this pull request Nov 20, 2014
fixed quantities on items import
@jekkos
jekkos merged commit 90c1934 into opensourcepos:master Nov 20, 2014
@whumphreys90

Copy link
Copy Markdown

hi, im new with php and this software, 1 of all i really liked as i tried it, but cant find a way to import csv no matter how much i tried im not lucky, i even deleted data base set a new new one it works once then it doesnt anymore help please

@daN4cat

daN4cat commented Jan 13, 2016

Copy link
Copy Markdown
Collaborator

@whumphreys90 what about creating a new issue with your problem? Also, could you please indicate which version you are using? Thanks

@jekkos

jekkos commented Jan 13, 2016

Copy link
Copy Markdown
Member

Post as much info as you can, in this case example of the csv file you used, error messages you get or screencap of the errored screen.

@whumphreys90

Copy link
Copy Markdown

i have version 2.3.3
my case is the following, i downloaded the import_items csv sheet then uploaded it as it says, and it works but i didnt opened the file , now that i opened the file and add few rows more to test it is failling to import, it just load like for 2 secs and do nothing, no error codes,

import items issues

i was taking a look at the codes, i also have a question is there is a way to change csv format, like for example i think the issue is when i open it with excel and save it adds or do something that can damage it, i fill out every required line yet still have the same problem

@whumphreys90

Copy link
Copy Markdown

also i will like to know if i can add an image for item

@jekkos

jekkos commented Jan 13, 2016

Copy link
Copy Markdown
Member

You have to use unique upc numbers for each item. If not then import will fail.

@whumphreys90

Copy link
Copy Markdown

thank you so much that was it, do u have any documentation of the theme it self, i'll like to try the following, change datebase option so if any id, name, upc, etc is repeated this insert do an update so the issue wont persist at all, can you tell me which will be the templates i need to do so

@odiea odiea mentioned this pull request May 1, 2023
23 of 34 tasks
ismaeldouglasdev added a commit to ismaeldouglasdev/opensourcepos that referenced this pull request Aug 2, 2026
…ors list, reprint last sale, beep sounds, stock badge, qty steppers, change breakdown

- opensourcepos#3 New Caixa module (cash_flow table + seeds, Cash controller/model, manage/form views, lang pt-BR/en, routes, header menu)
- opensourcepos#5 Editable daily sales target with progress bar on Home dashboard (home/saveDailyTarget)
- opensourcepos#7 Sales-per-hour bar chart on Home dashboard
- opensourcepos#6 Fiado V1: debtors list (customers with open account_receivable balance)
- opensourcepos#4 Checkout modal shows troco breakdown in notes/coins
- opensourcepos#8 Inline quantity editing in register cart with +/- steppers and auto-submit on change
- opensourcepos#12 Reimprimir Última Venda button (Printer::postQuickPrintLast)
- opensourcepos#13 WebAudio beep feedback on scan/add/payment/finish
- opensourcepos#10 Stock alert badge on ITENS nav link
ismaeldouglasdev added a commit to ismaeldouglasdev/opensourcepos that referenced this pull request Oct 5, 2026
…t, N+1 de impostos)

Auditoria de performance e de falhas silenciosas. Destas tres, so uma mexo no
caminho do caixa, e as tres sao defensivas — nenhuma pode piorar o caminho
existente.

1) OSPOSRules::gcaptcha_check sem timeout (app/Config/Validation/OSPOSRules.php)

   Nao havia CURLOPT_TIMEOUT nem CURLOPT_CONNECTTIMEOUT, entao valia o default
   do libcurl: ~300s de espera para conectar e nenhum limite total. Se o Google
   estivesse inacessivel, POST /login travava 5 MINUTOS — antes do caixa abrir.
   gcaptcha_enable=0 nos dois ambientes, entao esta dormindo; o problema e a
   cliff, nao o consumo de hoje. Agora 3s/2s.

2) postQuickFinish sem Content-Type (app/Controllers/Sales.php)

   O endpoint responde JSON em TODOS os caminhos, incluindo os tres early
   returns de erro, e nenhum deles setava o content type. Com ENVIRONMENT
   diferente de production o debugbar do CI4 anexa HTML na resposta, o
   parseJSON do cliente falha calado e a tela nao mostra confirmacao — a venda
   volta a ser salva. Mesma classe do fix opensourcepos#6. O setContentType foi para o topo
   do metodo, cobrindo os quatro pontos de saida.

3) N+1 dos impostos por linha do carrinho (app/Libraries/Tax_lib.php)

   get_taxes() roda a cada item escaneado (addAjax) e no checkout, e pedia os
   impostos de um item por vez. Como use_destination_based_tax=0 em producao, o
   caminho esta ligdo: o numero de queries crescia com o carrinho.

   Os impostos do carrinho inteiro agora sao carregados uma vez antes do loop,
   com Item_taxes::get_multiple_info() — que ja existia (commit 418ddc5, para
   a grid). Item sem imposto simplesmente nao aparece no resultado agrupado, que
   e o mesmo que get_info() devolvendo array vazio.

   Medido com o contador 'Questions' do MariaDB, 20 addAjax, mesmo carrinho de
   4 itens: 34 -> 31 queries por request. Bate com a conta (4 queries
   individuais viram 1), e a economia cresce com o carrinho.

   **O tempo nao mudou**: mediana 0,153s antes contra 0,163s depois, dentro do
   ruido. Tres queries indexadas custam fracao de milissegundo, e o custo real
   do addAjax sao os ~143KB de render + parse (achado da secao 74). A mudanca
   esta correta e elimina o N+1, mas o relogio nao sente — registering para
   ninguem confundir com ganho de velocidade.

Verificado no teste: checkout completo com 4 itens, resposta JSON pura
(Content-Type application/json, corpo de 33 bytes, sale_id e success), venda
salva, estoque debitado, zero CRITICAL/ERROR no log. Producao com backup
.bak-20261005-1449, sem log de hoje (nada gravado = zero erro).

ACHADO GRAVE, NAO CORRIGIDO AQUI — ver mensagem do relatório: postQuickFinish
finaliza a venda como COMPLETED sem conferir se o pagamento cobre o total.
Reproduzido de proposito durante o teste: carrinho de R$ 3.584,00 fechado com
R$ 164,00. Fica para decisao porque "Fiado" e subpagamento legitimo, entao a
regra precisa de desenho e nao pode ser so "pague o total".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants