function updatePrevisionStateWithDeliveryType($deliveryType) { global $country; $resultInfo = array(); $clothIds = ""; $query = "SELECT distinct(pc.clothId) as id, c.name, p.orderNumber\n\t\t\t\t\t\tFROM previsions p\n\t\t\t\t\t\tJOIN previsioncloth pc on p.id=pc.previsionId\n\t\t\t\t\t\tLEFT JOIN plotters pl on pl.previsionId = p.id\n\t\t\t\t\t\tJOIN cloths c on c.id=pc.clothId\n\t\t\t\t\t\twhere (p.designed=false or (p.designed=true and pl.id is not null))\n\t\t\t\t\t\tand (pl.cutted is null or pl.cutted=false)\n\t\t\t\t\t\tand p.state = '{$deliveryType}'\n\t\t\t\t\t\tand p.country = '{$country}'\n\t\t\t\t\t\torder by p.orderNumber, p.id, pc.clothId"; $result = mysql_query($query); foreach (fetch_array($result) as $cloth) { $clothResult = new stdClass(); $res = updatePrevisionState($cloth['id']); $clothResult->countModified = count($res->modifiedPrevisions); $clothResult->clothId = $cloth['id']; $clothResult->clothName = $cloth['name']; $clothResult->orderNumber = $cloth['orderNumber']; $clothIds .= $cloth['id'] . " / " . $cloth['orderNumber'] . ", "; array_push($resultInfo, $clothResult); } $obj->successful = true; $obj->method = "updatePrevisionStateWithDeliveryType({$deliveryType})"; $obj->resultInfo = $resultInfo; // log manual action of previ state update $log->type = "info.updatePrevisionStateWithDeliveryType({$deliveryType})"; $log->log = $clothIds; //implode(" == ", $resultInfo); $log->user = '******'; addLog($log); return $obj; }
//var_dump($request_payload); $json = json_decode($request_payload); if (isset($_GET['designed'])) { $value = setDesigned($json); } else { if (isset($_GET['updateMts'])) { $value = updateMts($json); } else { if (isset($_GET['edit']) && isset($_GET['isNumber'])) { $value = editPrevisionNumberField($json, $_GET['field']); } else { if (isset($_GET['edit'])) { $value = editPrevisionField($json, $_GET['field']); } else { if (isset($_GET['updatePrevisionState']) && isset($_GET['clothIds'])) { $value = updatePrevisionState($_GET['clothIds']); } else { if (isset($_GET['updatePrevisionState']) && isset($_GET['deliveryType'])) { $value = updatePrevisionStateWithDeliveryType($_GET['deliveryType']); } else { if (isset($_GET['updateAllPrevisionsStates'])) { $value = updateAllPrevisionsStates(); } else { if (isset($_GET['acceptStateChange'])) { $value = acceptStateChange($json); } else { if (isset($_GET['weeksBySeason'])) { $value = updateWeeksBySeason($json); } else { if (isset($_GET['listForProduction'])) { $value = getPrevisions(null, null, $expand, true, null, $_GET['sellerCode'], $_GET['offset'], $json);
} else { if (isset($_GET['listHistoric'])) { // deprecated - use with POST $value = getPrevisions(null, null, $expand, null, true, $_GET['sellerCode']); } else { if (isset($_GET['expand']) && $_GET['expand'] == 'NONE') { $value = getPrevisionsBasic(); } else { if (isset($_GET['checkAllClothsCutted'])) { $value = checkAllClothsCutted($_GET['previsionId']); } else { if (isset($_GET['updateAllPrevisionsStates'])) { $value = updateAllPrevisionsStates($_GET['updateClothId'], $_GET['limit'], $_GET['offset']); } else { if (isset($_GET['updatePrevisionState'])) { $value = updatePrevisionState($_GET['updateClothId']); } else { if (isset($_GET['weeksBySeason'])) { $value = getWeeksBySeason($_GET['weeksBySeason']); } else { $value = getPrevisions(null, $designed, $expand, null); } } } } } } } } } }