diff --git a/application/Api/v1/Modules/Operationaldata/SnoppCitycom.php b/application/Api/v1/Modules/Operationaldata/SnoppCitycom.php index 82b6b3e08..930bba7b8 100644 --- a/application/Api/v1/Modules/Operationaldata/SnoppCitycom.php +++ b/application/Api/v1/Modules/Operationaldata/SnoppCitycom.php @@ -129,9 +129,11 @@ class SnoppCitycom extends Modules\ApiControllerModule if($preorder->status->code < 500) { $preorder->setNewStatusCode(500); $preorder->save(); - // update billing_date if nessecary - $cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]); + } + // update billing_date if nessecary + $this->log->debug(__METHOD__.": Updating billing_date for {$ctag->ext_name} (Preorder {$preorder->id} {$preorder->oaid})"); + $cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]); return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]); } @@ -200,10 +202,10 @@ class SnoppCitycom extends Modules\ApiControllerModule if($preorder->status->code < 500) { $preorder->setNewStatusCode(500); $preorder->save(); - - // update billing date in citycom service - $cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]); } + // update billing date in citycom service + $this->log->debug(__METHOD__.": Updating billing_date for {$ctag->ext_name} (Preorder {$preorder->id} {$preorder->oaid})"); + $cc_api->updateService($ctag->ext_id, ["billing_date" => (new \DateTime("now"))->format("Y-m-d")]); return \mfResponse::Ok(["message" => "Service active already", "activation_status" => "active"]); } diff --git a/lib/Citycom/OanApiHelper.php b/lib/Citycom/OanApiHelper.php index 0ac26a079..271729603 100644 --- a/lib/Citycom/OanApiHelper.php +++ b/lib/Citycom/OanApiHelper.php @@ -299,6 +299,8 @@ class Citycom_OanApiHelper { $service_data = []; + //var_dump($service);exit; + // update service if nesseccary if(array_key_exists("product_name", $data) && $data["product_name"] && $service->product->name != $data["product_name"]) { $product_data["up"] = $data["up"]; @@ -314,7 +316,7 @@ class Citycom_OanApiHelper { } // update contact data - foreach(["company", "firstname", "lastname", "phone"] as $field) { + foreach(["company", "firstname", "lastname", "phone", "billing_date"] as $field) { if(array_key_exists($field, $data) && $data[$field] && $service->$field != $data[$field]) { $service_data[$field] = $data[$field]; } @@ -322,8 +324,9 @@ class Citycom_OanApiHelper { if(!count($service_data)) return true; $result = $this->api->updateService($service->id, $service_data); - if($result) return true; + + $this->log->warning(__METHOD__.": Update service ".$service->id." failed. Last error: {$this->api->lastError}"); return false; } diff --git a/scripts/preorder/citycom/order-mgmt-services.php b/scripts/preorder/citycom/order-mgmt-services.php index 1398445e2..bd09e2071 100644 --- a/scripts/preorder/citycom/order-mgmt-services.php +++ b/scripts/preorder/citycom/order-mgmt-services.php @@ -48,7 +48,7 @@ foreach(PreordercampaignModel::search(["fulfillment" => "citycom_oan"]) as $camp "down" => 100, "up" => 100, "product_name" => "Estmk Greenstream OAN Default", - "execution_date" => false, + "execution_date" => (new DateTime("+1 month"))->format("Y-m-d"), "company" => $preorder->company, "firstname" => $preorder->firstname, "lastname" => $preorder->lastname,