| @@ 44-58 (lines=15) @@ | ||
| 41 | return array_search($this->type, $this->getDebtorTypes()); |
|
| 42 | } |
|
| 43 | ||
| 44 | function getDBQuery() |
|
| 45 | { |
|
| 46 | if ($this->dbquery) { |
|
| 47 | return $this->dbquery; |
|
| 48 | } |
|
| 49 | ||
| 50 | $this->dbquery = new Intraface_DBQuery($this->kernel, "debtor", "debtor.active = 1 AND debtor.intranet_id = ".$this->kernel->intranet->get("id")); |
|
| 51 | $this->dbquery->setJoin("LEFT", "contact", "debtor.contact_id = contact.id AND contact.intranet_id = ".$this->kernel->intranet->get("id"), ''); |
|
| 52 | $this->dbquery->setJoin("LEFT", "address", "address.belong_to_id = contact.id AND address.active = 1 AND address.type = 3", ''); |
|
| 53 | $this->dbquery->setJoin("LEFT", "debtor_item", "debtor_item.debtor_id = debtor.id AND debtor_item.active = 1 AND debtor_item.intranet_id = ".$this->kernel->intranet->get("id"), ''); |
|
| 54 | ||
| 55 | $this->dbquery->useErrorObject($this->error); |
|
| 56 | ||
| 57 | return $this->dbquery; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Bruges til at lave en menu p� kontakten eller produktet |
|
| @@ 120-135 (lines=16) @@ | ||
| 117 | unset($this->item); // consider desctruct |
|
| 118 | } |
|
| 119 | ||
| 120 | function getDBQuery() |
|
| 121 | { |
|
| 122 | if ($this->dbquery) { |
|
| 123 | return $this->dbquery; |
|
| 124 | } |
|
| 125 | ||
| 126 | $this->dbquery = new Intraface_DBQuery($this->kernel, "debtor", "debtor.active = 1 AND debtor.intranet_id = ".$this->kernel->intranet->get("id")); |
|
| 127 | $this->dbquery->setJoin("LEFT", "contact", "debtor.contact_id = contact.id AND contact.intranet_id = ".$this->kernel->intranet->get("id"), ''); |
|
| 128 | $this->dbquery->setJoin("LEFT", "address", "address.belong_to_id = contact.id AND address.active = 1 AND address.type = 3", ''); |
|
| 129 | $this->dbquery->setJoin("LEFT", "debtor_item", "debtor_item.debtor_id = debtor.id AND debtor_item.active = 1 AND debtor_item.intranet_id = ".$this->kernel->intranet->get("id"), ''); |
|
| 130 | ||
| 131 | $this->dbquery->useErrorObject($this->error); |
|
| 132 | ||
| 133 | return $this->dbquery; |
|
| 134 | } |
|
| 135 | ||
| 136 | /** |
|
| 137 | * Creates a debtor |
|
| 138 | * |
|