diff --git a/application/Admin/functions/IvtContractImport.php b/application/Admin/functions/IvtContractImport.php index f33005d1f..5ebd40712 100644 --- a/application/Admin/functions/IvtContractImport.php +++ b/application/Admin/functions/IvtContractImport.php @@ -30,10 +30,8 @@ class Admin_IvtContractImport { 13322 => 2623, 2034 => false, 561 => false, - 11409 => 1222, // x-tec 1842 14192 => 2596, - //tourismusverband thermen- & vulkanland 11221 => 1120, 11222 => 1044, @@ -42,22 +40,42 @@ class Admin_IvtContractImport { 11225 => 1002, 11226 => 999, 11227 => 1000, - 2987 => 4126, // Atos - 14890 => 3612, 14891 => 3612, - 13551 => 2776, // Wolfgang Lipp 14908 => 2776, 13552 => 2055, - 10550 => 230, // Anneliese Wabnegg 10551 => 230, - 10995 => 1190 - - - + 10995 => 1190, + 12040 => 1687, // peter junior koch + 12179 => 1687, + 12982 => 1863, // reinhard strauss + 12983 => 1863, + 13188 => false, // magna + 10909 => 2820, // bernd zöhrer + 12101 => false, + 14679 => 2820, + 10041 => 3351, // walter würfel + 15759 => 3351, + 10483 => 1042, // joachim novak + 10850 => 1042, + 13216 => 1310, // theo werner koblischek + 13217 => 1310, + 13456 => 2060, + 13746 => 3614, // manfred hartmann + 13747 => 3614, + 13436 => 2076, // hernuß josef gmbh + 13437 => 2076, + 13440 => 2077, + 13441 => 2077, + 14295 => 3172, // Christa Eisenberger-Strobl + 15545 => 3172, + 14189 => 3322, // andeßner-angleitner + 16722 => 3322, + 16267 => 3079, // schmuck marianne + 16786 => 3079 ]; } @@ -73,7 +91,8 @@ class Admin_IvtContractImport { $last_cid = 0; $i = 0; - foreach(IvtCustomerProductModel::search(["lasdt_date>", "2023-04-01"], "cid") as $ivt_contract) { + foreach(IvtCustomerProductModel::search(["lastdate>", "2023-04-01"]) as $ivt_contract) { + //if($ivt_contract->cid < 104200) continue; //if($i > 1000 && $ivt_contract->cid != $last_cid) break; // only break after the last ivtcontract of this customer $last_cid = $ivt_contract->cid; diff --git a/application/Contract/ContractModel.php b/application/Contract/ContractModel.php index 036a2c765..cf3159c73 100644 --- a/application/Contract/ContractModel.php +++ b/application/Contract/ContractModel.php @@ -467,6 +467,22 @@ class ContractModel { $where .= " AND Contract.price >= $price"; } } + + if(array_key_exists("billing_period", $filter)) { + $billing_period = $filter['billing_period']; + if(is_numeric($billing_period)) { + $where .= " AND Contract.billing_period=$billing_period"; + } + } + + if(array_key_exists("finish_date>", $filter)) { + $finish_date = $filter['finish_date>']; + if(is_numeric($finish_date)) { + $where .= " AND Contract.finish_date >= $finish_date"; + } + } + + if(array_key_exists("add-where", $filter)) { $where .= " ".$filter['add-where']; diff --git a/application/IvtCustomerProduct/IvtCustomerProduct.php b/application/IvtCustomerProduct/IvtCustomerProduct.php index 592f7b431..c2cc0f9e2 100644 --- a/application/IvtCustomerProduct/IvtCustomerProduct.php +++ b/application/IvtCustomerProduct/IvtCustomerProduct.php @@ -33,9 +33,9 @@ class IvtCustomerProduct extends mfBaseModel { if($name == "product") { $ivtproduct = new IvtProduct($this->pid); if($ivtproduct->id) { - $this->ivtproduct = $ivtproduct; + $this->product = $ivtproduct; } - return $this->ivtproduct; + return $this->product; } if($name == "customer") { diff --git a/application/IvtCustomerProduct/IvtCustomerProductModel.php b/application/IvtCustomerProduct/IvtCustomerProductModel.php index 4c672e4b4..0fef4decf 100644 --- a/application/IvtCustomerProduct/IvtCustomerProductModel.php +++ b/application/IvtCustomerProduct/IvtCustomerProductModel.php @@ -15,7 +15,7 @@ class IvtCustomerProductModel { $res = $db->select("customer_product", "*", "1=1 ORDER BY $order"); if($db->num_rows($res)) { while($data = $db->fetch_object($res)) { - $items[] = new IvtCustomerTelephoneNr($data); + $items[] = new IvtCustomerProduct($data); } } return $items; @@ -28,7 +28,7 @@ class IvtCustomerProductModel { $res = $db->select("customer_product", "*", "$where ORDER BY id LIMIT 1"); if($db->num_rows($res)) { $data = $db->fetch_object($res); - $item = new IvtCustomerTelephoneNr($data); + $item = new IvtCustomerProduct($data); if($item->id) { return $item; } else { @@ -63,7 +63,7 @@ class IvtCustomerProductModel { if(is_array($limit) && count($limit)) { if(is_numeric($limit['start']) && is_numeric($limit['count'])) { $sql .= " LIMIT ".$limit['start'].", ".$limit['count']; - } elseif(is_numeric($count)) { + } elseif(is_numeric($limit['count'])) { $sql .= " LIMIT ".$limit['count']; } } @@ -71,7 +71,7 @@ class IvtCustomerProductModel { $res = $db->query($sql); if($db->num_rows($res)) { while($data = $db->fetch_object($res)) { - $items[] = new IvtCustomerTelephoneNr($data); + $items[] = new IvtCustomerProduct($data); } } return $items; @@ -79,24 +79,7 @@ class IvtCustomerProductModel { private static function getSqlFilter($filter) { $where = "1=1 "; - - /* - if(array_key_exists("status_id", $filter)) { - $status_id = $filter['status_id']; - if(is_numeric($status_id)) { - $where .= " AND IvtCustomerProduct.status_id=$status_id"; - } - } - - - if(array_key_exists("street", $filter)) { - $street = FronkDB::singleton()->escape($filter["street"]); - if($street) { - $where .= " AND street like '%$street%'"; - } - } - */ - + if(array_key_exists("cid", $filter)) { $cid = $filter['cid']; if(is_numeric($cid)) { @@ -118,10 +101,11 @@ class IvtCustomerProductModel { } } - if(array_key_exists("last_date>", $filter)) { - $last_date = $filter['last_date>']; - if(is_numeric($last_date)) { - $where .= " AND last_date >=$last_date"; + //var_dump($filter);exit; + if(array_key_exists("lastdate>", $filter)) { + $lastdate = $filter['lastdate>']; + if($lastdate) { + $where .= " AND lastdate >= $lastdate"; } } diff --git a/scripts/test.php b/scripts/test.php index bf97dec6c..c9ca9b70b 100644 --- a/scripts/test.php +++ b/scripts/test.php @@ -15,8 +15,50 @@ $me = new User(1); define("INTERNAL_USER_ID", $me->id); define("INTERNAL_USER_USERNAME", $me->username); -$block = new Voicenumberblock(2); -$free = $block->getFreeNumbers(); +$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'; +$charsLength = strlen($chars); -echo implode("\n", $free); -echo "\n"; \ No newline at end of file +$c = 0; + +$db = FronkDB::singleton(); +$res = $db->query("SELECT id FROM Preorder WHERE oaid IS NOT NULL ORDER BY RAND()"); +/*while($data = $db->fetch_object($res)) { + if($c > 1000) break; + + $preorder = new Preorder($data->id); + if(!$preorder->oaid) { + echo "no oaid ".$preorder->id."\n"; + } + $oaid = $preorder->oaid; + $ucode = ''; + for($i = 0; $i < 20; $i++) { + $ucode .= $chars[rand(0, $charsLength - 1)]; + } + + echo "$oaid;$ucode\n"; + $c++; +}*/ + +$stati = PreorderstatusModel::getAll(); + +while($data = $db->fetch_object($res)) { + if($c > 1000) break; + + $preorder = new Preorder($data->id); + if(!$preorder->oaid) { + echo "no oaid ".$preorder->id."\n"; + } + $oaid = $preorder->oaid; + + $r = rand(0, count($stati)-1); + $new_status = $stati[$r]; + + if(!$new_status->code) { + fwrite(STDERR, "status not found\n"); + continue; + } + + echo "$oaid;".$new_status->code."\n"; + + $c++; +} \ No newline at end of file