Giter VIP home page Giter VIP logo

Comments (15)

LukeOtdr avatar LukeOtdr commented on June 28, 2024

from api-subiekt-gt.

prusmarcin avatar prusmarcin commented on June 28, 2024

`protected function setGtObject(){
if(!$this->is_exists){
$new_prefix = SubiektGT::getInstance()->getConfig()->getNewProductPrefix();
if(strlen($new_prefix)>0){
$this->productGt->Nazwa = substr("{$new_prefix} {$this->name}",0,50);
}else{
$this->productGt->Nazwa = substr("{$this->name}",0,50);
}
}else{
$this->productGt->Nazwa = substr("{$this->name}",0,50);
}
$this->productGt->TowarRodzaj = 2;
//$this->productGt->TowarRodzaj = 'usługa';
$this->productGt->Opis = $this->name;
$this->productGt->Symbol = substr(sprintf('%s',$this->code),0,20);
$this->productGt->Aktywny = true;
$this->productGt->CzasDostawy = $this->time_of_delivery;
if($this->supplier_id != ''){
$this->productGt->DostawcaId = $this->supplier_id;
}
//cena detaliczna
if($this->productGt->Ceny->Liczba>0){
$this->productGt->Ceny->Element(1)->Brutto = floatval($this->price);
}

	//cena hurtowa
	if($this->productGt->Ceny->Liczba>1 && $this->wholesale_price>0){
		$this->productGt->Ceny->Element(2)->Netto = floatval($this->wholesale_price);			
	}



	if(strlen($this->supplier_code)>0){
		 $this->productGt->SymbolUDostawcy = substr(sprintf('%s',$this->supplier_code),0,20);
	}
	$ean = sprintf('%d',trim($this->ean));
	if(!$this->is_exists && $ean>0){
		$this->productGt->KodyKreskowe->Dodaj($ean);
	}
	return true;
}`

przetestowałem obie wersje lecz nie dziala nic sie nie dodaje ...

from api-subiekt-gt.

LukeOtdr avatar LukeOtdr commented on June 28, 2024

To może inaczej spróbuj odczytać. wartość i zapisać do jakiegoś loga zrzut całego obiektu albo dodać do odpowiedzi JSON-a. To co podałem jest w dokumentacji sfery więc teoretycznie powinno działać. Dlatego spróbuj odczytać ten atrybut z jakiegoś utworzonego obiektu - może dokumentacja jest nie ścisła.

from api-subiekt-gt.

paweleq1994 avatar paweleq1994 commented on June 28, 2024

W przypadku dodania do funkcji getGtObject() $this->rodzaj = $this->productGt->Rodzaj; ładnie zwraca id rodzaju jako integer. Problem pojawia się w przypadku użycia tego w funkcji setGtObject(). Po dodaniu $this->productGt->Rodzaj = intval($this->rodzaj) dostaję wiadomość "Error [0x8002000e] Nieprawidłowa liczba parametrów.\r\n". Siedzę nad tym problemem już kilka godzin i nie jestem w stanie wymyślić co tu może być nie tak. Dodam tylko, że analogicznie zrobiłem $this->productGt->ProducentId = intval($this->producentId); i działa bez zarzutu. Jakieś pomysły?

Zamówienie składa się z pozycji wg mojej wiedzy i pozycje to są albo towary albo usługi, wiec jeśli to masz na myśli to: trzeba w product.php w metodzie setGtObject ustawić: $this->productGt->TowarRodzaj = 2; // lub nie testowałem to wyczytałem z dokumentacji obiektu pozycji sfery - więc któraś na pewno zadziała. $this->productGt->TowarRodzaj = 'usługa';

Nazwa samej metody to po prostu Rodzaj. Poniżej screen z dokumentacji:

image

from api-subiekt-gt.

LukeOtdr avatar LukeOtdr commented on June 28, 2024

from api-subiekt-gt.

MaciejSzypnicky avatar MaciejSzypnicky commented on June 28, 2024

Cześć, dziś napotkałem ten sam problem (Error [0x8002000e]) . Nie chodzi tu o typ zmiennej. Do tworzenia kompletów (TowaryKolekcja) w sferze jest inna metoda niż do tworzenia towaru.
Dostępne metody według pomocy to
DodajKomplet
DodajOpakowanie
DodajOplate
DodajTowar
DodajUsluge
Więc w metodzie Product/add() trzeba dokonać zmiany w zależności od typu.
np


if($this->type == 8){
	$this->productGt = $this->subiektGt->TowaryManager->DodajKomplet();
}else{
	$this->productGt = $this->subiektGt->TowaryManager->DodajTowar();
}

Pozdrawiam
Maciej Szypnicki

from api-subiekt-gt.

stempol90 avatar stempol90 commented on June 28, 2024

Witam,

Mam ten sam problem. Sprawdziłem podane tutaj rozwiązania i niestety żadne nie działa.
Problem mamy zarówno z utworzeniem Towaru jak i Usługi

Jeśli towar istnieje w bazie to nie nie problemu natomiast próby utworzenia kończą sie błędami:

  • Nieznana liczba parametrów
  • Source: Subiekt.Towar.1 Błąd zapisu do bazy danych. Zapis...

Jakieś jeszcze pomysły co można zrobić ?

Pozdrawiam
Daniel

from api-subiekt-gt.

kogutu avatar kogutu commented on June 28, 2024

Odswieze temat: mianowicie chce dodac usluge transportu, lecz gdy dodaje tak jak ponizej dostaje notoryczne zwrotke:
Source: InsERT.GT.1Description: Niedopasowanie typu - sprawdzilem typy i raczej sa zgodne - gdzie moglby lezec blad?
PS. w product.php wprowadzilem $this->productGt->Rodzaj= intval($this->rodzaj);

"products": [
			{
				"code": "produkt",
				"ean": "5907691111820",
				"price": "419",
				"qty": 1,
				"price_before_discount": "419",
				"name": "produkt",
				"id_store": "6",
				"rodzaj": "1"
			},
			{
				"ean": "5907698663157",
				"code": "USŁUGA TRANSPORTOWA",
				"qty": 1,
				"price": "47",
				"price_before_discount": "47",
				"name": "Usługa transportowa",
				"id_store": "1",
				"rodzaj": "2"
			}
		]

from api-subiekt-gt.

LukeOtdr avatar LukeOtdr commented on June 28, 2024

from api-subiekt-gt.

kogutu avatar kogutu commented on June 28, 2024

Stwórz usługę transportową w kartotece produktów nadaj jej symbol i wyślij ten symbol w trakcie składania zamówienia - za dużo kombinujesz :). pon., 19 lip 2021 o 13:40 kogutu @.***> napisał(a):

Odswieze temat: mianowicie chce dodac usluge transportu, lecz gdy dodaje tak jak ponizej dostaje notoryczne zwrotke: Source: InsERT.GT.1Description: Niedopasowanie typu - sprawdzilem typy i raczej sa zgodne - gdzie moglby lezec blad? PS. w product.php wprowadzilem $this->productGt->Rodzaj= intval($this->rodzaj); "products": [ { "code": "produkt", "ean": "5907691111820", "price": "419", "qty": 1, "price_before_discount": "419", "name": "produkt", "id_store": "6", "rodzaj": "1" }, { "ean": "5907698663157", "code": "USŁUGA TRANSPORTOWA", "qty": 1, "price": "47", "price_before_discount": "47", "name": "Usługa transportowa", "id_store": "1", "rodzaj": "2" } ] — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <#90 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTVRMRKQKRGMRJRGTPACHDTYQFJTANCNFSM4TCBIGAA .
-- Pozdrawiam Łukasz Golonka

Kurcz wydaje mi sie, ze tak mam zrobione - usluge transportowa mam jako towar (tw__Towar) z tym, ze rodzaj (pole) odpowiada wartosci 2 (usluga) .

Sorry za glupie pytanie ale mozesz mnie jakos naprowadzic bardziej? ;)

from api-subiekt-gt.

LukeOtdr avatar LukeOtdr commented on June 28, 2024

from api-subiekt-gt.

kogutu avatar kogutu commented on June 28, 2024

Luke dzieki za odp - temat rozwiazany - w sumie nie wiem czemu ale wystarczyla zmiana nazwy i symbolu istniejacej uslugi transportu i wszystko ladnie wskoczylo. I potwierdzam, nie potrzebne jest przypisywanie rodzaju - rodzaj pobierany jest na poczatku przy wczytywaniu produktu/uslugi juz istniejacej.

from api-subiekt-gt.

LukeOtdr avatar LukeOtdr commented on June 28, 2024

from api-subiekt-gt.

kogutu avatar kogutu commented on June 28, 2024

Witaj Luke, jeszcze musze Ci ostatni raz glowe zawrocic (z gory przepraszam).

  1. Dodaje nowe zamowienie dla klienta nie bedacego w bazie - przy probie dodania zamowienia otrzymuje komunikat:
{
  "state": "fail",
  "message": "Source: UnknownDescription: Unknown",
  "obj_dump": "APISubiektGT\\SubiektGT\\Order Object\n(\n    [orderGt:protected] => variant Object\n        (\n        )\n\n    [products:protected] => Array\n        (\n            [0] => Array\n                (\n                    [code] => produkt\n                    [ean] => 5907698611820\n                    [price] => 419\n                    [qty] => 1\n                    [price_before_discount] => 419\n                    [name] => produkt UNIF, biaĹ�y + czarny\n                    [id_store] => 6\n                    [rodzaj] => 1\n                )\n\n            [1] => Array\n                (\n                    [code] => TRANSPORT DPD\n                    [ean] => 5907698663157\n                    [price] => 47\n                    [qty] => 1\n                    [price_before_discount] => 47\n                    [name] => UsĹ�uga transportowa - DPD\n                    [id_store] => 6\n                    [rodzaj] => 2\n                )\n\n        )\n\n    [reference:protected] => \n    [title:protected] => Zamówienie od klienta\n    [subtitle:protected] => MP-1120-07-2021\n    [comments:protected] => \n    [nr_listu_przewozowego:protected] => 666\n    [oid:protected] => MP-1120-07-2021\n    [customer:protected] => Array\n        (\n            [ref_id] => dd512333485\n            [firstname] => Dumpi\n            [lastname] => Dumper\n            [email] => [email protected]\n            [address] => Sopocka\n            [address_no] => 21\n            [city] => WrocĹ�aw\n            [post_code] => 50-344\n            [phone] => 512333485\n            [is_company] => \n            [company_name] => \n            [tax_id] => \n        )\n\n    [reservation:protected] => 1\n    [order_ref:protected] => \n    [selling_doc:protected] => \n    [amount:protected] => 466.97\n    [paid_amount:protected] => 0\n    [state:protected] => -1\n    [date_of_delivery:protected] => \n    [payment_comments:protected] => \n    [pay_type:protected] => Przelew24\n    [create_product_if_not_exists:protected] => 0\n    [orderDetail:protected] => Array\n        (\n            [comments] => \n            [title] => ZamĂłwienie od klienta\n            [subtitle] => MP-1120-07-2021\n            [nr_listu_przewozowego] => 666\n            [oid] => MP-1120-07-2021\n            [create_product_if_not_exists] => 0\n            [amount] => 466.97\n            [pay_type] => Przelew24\n            [customer] => Array\n                (\n                    [ref_id] => dd512333485\n                    [firstname] => Dumpi\n                    [lastname] => Dumper\n                    [email] => [email protected]\n                    [address] => Sopocka\n                    [address_no] => 21\n                    [city] => WrocĹ�aw\n                    [post_code] => 50-344\n                    [phone] => 512333485\n                    [is_company] => \n                    [company_name] => \n                    [tax_id] => \n                )\n\n            [products] => Array\n                (\n                    [0] => Array\n                        (\n                            [code] => produkt\n                            [ean] => 5907698611820\n                            [price] => 419\n                            [qty] => 1\n                            [price_before_discount] => 419\n                            [name] => produkt UNIF, biaĹ�y + czarny\n                            [id_store] => 6\n                            [rodzaj] => 1\n                        )\n\n                    [1] => Array\n                        (\n                            [code] => TRANSPORT DPD\n                            [ean] => 5907698663157\n                            [price] => 47\n                            [qty] => 1\n                            [price_before_discount] => 47\n                            [name] => UsĹ�uga transportowa - DPD\n                            [id_store] => 6\n                            [rodzaj] => 2\n                        )\n\n                )\n\n        )\n\n    [order_processing:protected] => \n    [id_flag:protected] => 0\n    [flag_txt:protected] => \n    [pay_point_id:protected] => 0\n    [subiektGt:protected] => variant Object\n        (\n        )\n\n    [is_exists:protected] => \n    [gt_id:protected] => \n    [cfg:protected] => APISubiektGT\\Config Object\n        (\n            [server:protected] => 127.0.0.1\\INSERTGT,1433\n            [dbuser:protected] => sa\n            [dbpassword:protected] => \n            [database:protected] => mebel_partner_trading\n            [_ini_file:protected] => C:\\xampp\\htdocs\\public/../config/api-subiekt-gt.ini\n            [api_key:protected] => fpecezz1eu563pt6o0cdt47unrua8g\n            [new_product_prefix:protected] => mag\n            [id_person:protected] => Artur KrupiĹ�ski\n            [operator:protected] => Sikora Mateusz\n            [operator_password:protected] => mat%62\n            [id_warehouse:protected] => 1\n            [id_default_attribute:protected] => \n        )\n\n    [id_user:protected] => 1\n    [objDetail:protected] => Array\n        (\n            [comments] => \n            [title] => ZamĂłwienie od klienta\n            [subtitle] => MP-1120-07-2021\n            [nr_listu_przewozowego] => 666\n            [oid] => MP-1120-07-2021\n            [create_product_if_not_exists] => 0\n            [amount] => 466.97\n            [pay_type] => Przelew24\n            [customer] => Array\n                (\n                    [ref_id] => dd512333485\n                    [firstname] => Dumpi\n                    [lastname] => Dumper\n                    [email] => [email protected]\n                    [address] => Sopocka\n                    [address_no] => 21\n                    [city] => WrocĹ�aw\n                    [post_code] => 50-344\n                    [phone] => 512333485\n                    [is_company] => \n                    [company_name] => \n                    [tax_id] => \n                )\n\n            [products] => Array\n                (\n                    [0] => Array\n                        (\n                            [code] => produkt\n                            [ean] => 5907698611820\n                            [price] => 419\n                            [qty] => 1\n                            [price_before_discount] => 419\n                            [name] => produkt UNIF, biaĹ�y + czarny\n                            [id_store] => 6\n                            [rodzaj] => 1\n                        )\n\n                    [1] => Array\n                        (\n                            [code] => TRANSPORT DPD\n                            [ean] => 5907698663157\n                            [price] => 47\n                            [qty] => 1\n                            [price_before_discount] => 47\n                            [name] => UsĹ�uga transportowa - DPD\n                            [id_store] => 6\n                            [rodzaj] => 2\n                        )\n\n                )\n\n        )\n\n    [exclude_attibs:protected] => Array\n        (\n            [0] => subiektGt\n            [1] => exclude_attibs\n            [2] => cfg\n            [3] => doc_types\n            [4] => orderGt\n            [5] => orderDetail\n            [6] => pay_type\n            [7] => create_product_if_not_exists\n        )\n\n    [doc_types:protected] => Array\n        (\n            [1] => FZ\n            [2] => FS\n            [5] => KFZ\n            [6] => KFS\n            [9] => MM\n            [10] => PZ\n            [11] => WZ\n            [12] => PW\n            [13] => RW\n            [14] => ZW\n            [15] => ZD\n            [16] => ZK\n            [21] => PA\n            [29] => IW\n            [35] => ZPZ\n            [36] => ZWZ\n            [62] => FM\n        )\n\n)\n"

Komunikat pojawia sie w chwili zapisu Customera;
Orientujesz sie co moze byc skopane?
Moj wsad:

{
  "api_key": "fpecezz1eu563pt6o0cdt47unrua8g",
  "data": {
    "comments": "",
		"title":"Zamówienie od klienta",
   "subtitle": "MP-1120-07-2021",
		"nr_listu_przewozowego":"666",
		"oid":"MP-1120-07-2021",
    "create_product_if_not_exists": "0",
    "amount": "466.97",
    "pay_type": "Przelew24",
    "customer": {
      "ref_id": "dd512333485",
      "firstname": "Dumpi",
      "lastname": "Dumper",
      "email": "[email protected]",
      "address": "Sopocka",
      "address_no": "21",
      "city": "Wrocław",
      "post_code": "50-344",
      "phone": "512333485",
      "is_company": false,
      "company_name": "",
      "tax_id": ""
    },
    "products": [
			{
				"code": "produkt",
				"ean": "5907698611820",
				"price": "419",
				"qty": 1,
				"price_before_discount": "419",
				"name": "produkt UNIF, biały + czarny",
				"id_store": "6",
				"rodzaj": "1"
			},
			{
				
				"code": "TRANSPORT DPD",
				"ean": "5907698663157",
				"price": "47",				
				"qty": 1,
				"price_before_discount": "47",
				"name": "Usługa transportowa - DPD",
				"id_store": "6",
				"rodzaj": "2"
			}
    ]
  }
}
  1. Masz jakis dobry sposob na debuga objectu variant?

from api-subiekt-gt.

kogutu avatar kogutu commented on June 28, 2024

Wracam ad1. rozwiazanie problemu - dodanie property Typ

	`	$this->customerGt->Typ = 2;`

Opis:

0 - Oznacza kontrahenta typu Dostawca i Odbiorca
1 - Oznacza kontrahenta typu Dostawca
2 Oznacza kontrahenta typu Odbiorca

from api-subiekt-gt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.