Added Prepatching
This commit is contained in:
@@ -122,12 +122,12 @@ class PatchingModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function searchByTerminationCount($filter = false) {
|
||||
public static function searchByFinishedLineworkCount($filter = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getTerminationSqlFilter($filter);
|
||||
|
||||
|
||||
$sql = "SELECT COUNT(Termination.id) as cnt FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
@@ -152,16 +152,15 @@ class PatchingModel {
|
||||
return $data->cnt;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function searchByTermination($filter = false, $limit = false) {
|
||||
public static function searchByFinishedLinework($filter = false, $limit = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getTerminationSqlFilter($filter);
|
||||
|
||||
// TEMP: vorpatchen
|
||||
$sql = "SELECT Termination.id as termination_id FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
@@ -197,6 +196,83 @@ class PatchingModel {
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function searchByEnabledPatchingCount($filter = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getTerminationSqlFilter($filter);
|
||||
|
||||
$sql = "SELECT COUNT(Termination.id) as cnt FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
LEFT JOIN Termination ON (Termination.id = OrderProduct.termination_id)
|
||||
LEFT JOIN Terminationstatus ON (Terminationstatus.id = Termination.status_id)
|
||||
LEFT JOIN Building ON (Building.id = Termination.building_id)
|
||||
LEFT JOIN Buildingstatus ON (Buildingstatus.id = Building.status_id)
|
||||
LEFT JOIN Patching ON (Patching.Termination_id = OrderProduct.termination_id)
|
||||
LEFT JOIN Workflowitem ON (Workflowitem.object_type = 'Termination')
|
||||
LEFT JOIN Workflowvalue ON (Workflowvalue.item_id = Workflowitem.id)
|
||||
WHERE Termination.patching_enabled = 1
|
||||
AND Workflowitem.name = 'customer_passive_finished'
|
||||
AND Workflowvalue.object_id = OrderProduct.termination_id
|
||||
AND Workflowvalue.value_int <> 1
|
||||
AND $where";
|
||||
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
return $data->cnt;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function searchByEnabledPatching($filter = false, $limit = false) {
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getTerminationSqlFilter($filter);
|
||||
// TEMP: vorpatchen
|
||||
$sql = "SELECT Termination.id as termination_id FROM `Order`
|
||||
LEFT JOIN OrderProduct ON (OrderProduct.order_id = `Order`.id)
|
||||
LEFT JOIN Product ON (Product.id = OrderProduct.product_id)
|
||||
LEFT JOIN Termination ON (Termination.id = OrderProduct.termination_id)
|
||||
LEFT JOIN Terminationstatus ON (Terminationstatus.id = Termination.status_id)
|
||||
LEFT JOIN Building ON (Building.id = Termination.building_id)
|
||||
LEFT JOIN Buildingstatus ON (Buildingstatus.id = Building.status_id)
|
||||
LEFT JOIN Patching ON (Patching.Termination_id = OrderProduct.termination_id)
|
||||
LEFT JOIN Workflowitem ON (Workflowitem.object_type = 'Termination')
|
||||
LEFT JOIN Workflowvalue ON (Workflowvalue.item_id = Workflowitem.id)
|
||||
WHERE Termination.patching_enabled = 1
|
||||
AND Workflowitem.name = 'customer_passive_finished'
|
||||
AND Workflowvalue.object_id = OrderProduct.termination_id
|
||||
AND Workflowvalue.value_int <> 1
|
||||
AND $where
|
||||
GROUP BY Termination.id
|
||||
ORDER BY Termination.id ASC";
|
||||
|
||||
// AND (Patching.patched IS NULL OR Patching.patched = 0)
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
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)) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Termination($data->termination_id);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user