Merge branch 'fronkdev' into 'master'
Added citycom-mgmt-order cron script See merge request fronk/thetool!1669
This commit is contained in:
@@ -157,6 +157,13 @@ class PreordercampaignModel {
|
|||||||
$where .= " AND Network.owner_id IN (". implode(",", $owner_id).")";
|
$where .= " AND Network.owner_id IN (". implode(",", $owner_id).")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(array_key_exists("fulfillment", $filter)) {
|
||||||
|
$fulfillment = FronkDB::singleton()->escape($filter['fulfillment']);
|
||||||
|
if($fulfillment) {
|
||||||
|
$where .= " AND `Preordercampaign`.`fulfillment` = '$fulfillment'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(array_key_exists("name", $filter)) {
|
if(array_key_exists("name", $filter)) {
|
||||||
$name = FronkDB::singleton()->escape($filter['name']);
|
$name = FronkDB::singleton()->escape($filter['name']);
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
#!/usr/bin/php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
//require 'vendor/autoload.php';
|
|
||||||
require("../../config/config.php");
|
|
||||||
|
|
||||||
define('FRONKDB_SQLDEBUG', false);
|
|
||||||
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
||||||
|
|
||||||
require_once(LIBDIR . "/mvcfronk/mfRouter/mfRouter.php");
|
|
||||||
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseModel.php");
|
|
||||||
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseController.php");
|
|
||||||
|
|
||||||
$me = new User(1);
|
|
||||||
define("INTERNAL_USER_ID", $me->id);
|
|
||||||
define("INTERNAL_USER_USERNAME", $me->username);
|
|
||||||
define("MFBASE_BYPASS_LOGIN", true);
|
|
||||||
|
|
||||||
$cc = new Citycom_OanApiClient(CITYCOM_OAN_API_USER, CITYCOM_OAN_API_PASS);
|
|
||||||
$cc_helper = new Citycom_OanApiHelper($cc);
|
|
||||||
|
|
||||||
$default_data = [
|
|
||||||
"execution_date" => false,
|
|
||||||
"services" => CITYCOM_OAN_API_SERVICES_FOR_ORDER,
|
|
||||||
];
|
|
||||||
|
|
||||||
$services = [
|
|
||||||
[ // Max Haidvogl, Schillerstraße 11, Tür 1
|
|
||||||
"preorder" => new Preorder(22688),
|
|
||||||
"down" => 600,
|
|
||||||
"up" => 300,
|
|
||||||
"product_name" => "Estmk Greenstream OAN 600/300",
|
|
||||||
],
|
|
||||||
/*[ // Gerd Haidvogl, Schillerstraße 11, Tür 6
|
|
||||||
"preorder" => new Preorder(22682),
|
|
||||||
"down" => 300,
|
|
||||||
"up" => 150,
|
|
||||||
"product_name" => "Greenstream OAN 300/150",
|
|
||||||
],*/
|
|
||||||
/*[ // Robert Rottmann, Lange Gasse 7, Tür 1
|
|
||||||
"preorder" => new Preorder(22679),
|
|
||||||
"down" => 300,
|
|
||||||
"up" => 150,
|
|
||||||
"product_name" => "Greenstream OAN 300/150",
|
|
||||||
]*/
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach($services as $service) {
|
|
||||||
$preorder = $service["preorder"];
|
|
||||||
|
|
||||||
$data = $default_data;
|
|
||||||
$data["down"] = $service["down"];
|
|
||||||
$data["up"] = $service["up"];
|
|
||||||
$data["product_name"] = $service["product_name"];
|
|
||||||
$sublocation_id = \Citycom_OanApiHelper::hausnummerExtrefToCitycomId($preorder->adb_wohneinheit->extref);
|
|
||||||
|
|
||||||
var_dump($cc_helper->orderServices($preorder, $sublocation_id, $data));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
//require 'vendor/autoload.php';
|
||||||
|
require("../../../config/config.php");
|
||||||
|
|
||||||
|
define('FRONKDB_SQLDEBUG', false);
|
||||||
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||||
|
|
||||||
|
require_once(LIBDIR . "/mvcfronk/mfRouter/mfRouter.php");
|
||||||
|
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseModel.php");
|
||||||
|
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseController.php");
|
||||||
|
|
||||||
|
$me = new User(1);
|
||||||
|
define("INTERNAL_USER_ID", $me->id);
|
||||||
|
define("INTERNAL_USER_USERNAME", $me->username);
|
||||||
|
define("MFBASE_BYPASS_LOGIN", true);
|
||||||
|
|
||||||
|
$log = mfLoghandler::singleton();
|
||||||
|
|
||||||
|
$cc = new Citycom_OanApiClient(CITYCOM_OAN_API_USER, CITYCOM_OAN_API_PASS);
|
||||||
|
$cc_helper = new Citycom_OanApiHelper($cc);
|
||||||
|
|
||||||
|
foreach(PreordercampaignModel::search(["fulfillment" => "citycom_oan"]) as $campaign) {
|
||||||
|
foreach($campaign->active_preorders as $preorder) {
|
||||||
|
if(!$preorder->adb_wohneinheit_id) continue;
|
||||||
|
|
||||||
|
$has_inet_service = false;
|
||||||
|
$has_mgmt_service = false;
|
||||||
|
|
||||||
|
if(is_array($preorder->ctags) && count($preorder->ctags)) {
|
||||||
|
foreach ($preorder->ctags as $ctag) {
|
||||||
|
if ($ctag->network != "citycom-oan") continue;
|
||||||
|
|
||||||
|
if ($ctag->service_type == "inet") $has_inet_service = true;
|
||||||
|
if ($ctag->service_type == "mgmt") $has_mgmt_service = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($has_inet_service || $has_mgmt_service) continue;
|
||||||
|
|
||||||
|
$sublocation_id = \Citycom_OanApiHelper::hausnummerExtrefToCitycomId($preorder->adb_wohneinheit->extref);
|
||||||
|
$data = [
|
||||||
|
"down" => 100,
|
||||||
|
"up" => 100,
|
||||||
|
"product_name" => "Estmk Greenstream OAN Mgmt",
|
||||||
|
"execution_date" => false,
|
||||||
|
"services" => ["mgmt"],
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$log->info(__METHOD__.": Ordering mgmt service for preorder ".$preorder->id);
|
||||||
|
if(!$cc_helper->orderServices($preorder, $sublocation_id, $data)) {
|
||||||
|
$log->error(__METHOD__.": Error ordering mgmt service for preorder ".$preorder->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user