{"id":89,"date":"2013-12-13T08:07:03","date_gmt":"2013-12-13T08:07:03","guid":{"rendered":"http:\/\/tastaturkind.ch\/?p=89"},"modified":"2013-12-13T08:07:03","modified_gmt":"2013-12-13T08:07:03","slug":"order-cancellator-php","status":"publish","type":"post","link":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/2013\/12\/13\/order-cancellator-php\/","title":{"rendered":"Order Cancellator PHP"},"content":{"rendered":"<p><code><?php\ninclude 'checkuser.php';\n$db=\"  (DESCRIPTION =\n    (ADDRESS_LIST =\n      (ADDRESS = (PROTOCOL = TCP)(HOST = ardb04.ofrick.ch)(PORT = 1521))\n      (ADDRESS = (PROTOCOL = TCP)(HOST = ardb03.ofrick.ch)(PORT = 1521))\n    )\n    (CONNECT_DATA =\n      (SERVICE_NAME = AOM)\n    )\n  )\n\";\n$username=$_SESSION['username'];\nif ( isset ( $_REQUEST['arbor_user'] ) )\n{\n\t$_SESSION['arbor_user'] = $_REQUEST['arbor_user'] ;\n}\nif ( isset ( $_REQUEST['arbor_passwd'] ) )\n{\n\t$_SESSION['arbor_passwd'] = $_REQUEST['arbor_passwd'] ;\n}\n?><br \/>\n<html><br \/>\n<head><br \/>\n<title>Test 2<\/title><\/p>\n<style type=\"text\/css\" title=\"the ultimate cablecom style\">\n\t@import \"css\/std.css\";\n<\/style>\n<p><\/head><br \/>\n<body><br \/>\n<?php\ninclude 'head.php';\ninclude 'menu.php';\n?><\/p>\n<div id=\"content\">\n<p>\n<?php\nif ( isset ( $_REQUEST['account_no'] ) &#038;&#038; isset ( $_REQUEST['order_id'] ) \n\t&#038;&#038; isset ( $_REQUEST['order_id_resets'] ) &#038;&#038; isset ( $_REQUEST['cancel_text'] ) \n\t&#038;&#038; isset ( $_SESSION['arbor_user'] ) &#038;&#038; isset ( $_SESSION['arbor_passwd'] ) )\n{\n$account_no=$_REQUEST['account_no'];\n$order_id=$_REQUEST['order_id'];\n$order_id_resets=$_REQUEST['order_id_resets'];\n$text=$_REQUEST['cancel_text'];\n$conn=OCILogon($arbor_user, $arbor_passwd, $db);\n$stmt=OCIParse($conn, \"\n DECLARE\n\tv_order_id number := $order_id ;\n\tdoc number;\n BEGIN\n\thist_insert_history( v_order_id, 0, 1, '$account_no', NULL, NULL, '$text', SYSDATE, '$username',  NULL,  NULL,  NULL,  NULL,  NULL,  NULL, doc );\n\n\tUPDATE item_milestones SET status_id = 80 WHERE status_id <> 50<br \/>\n\tAND order_id = v_order_id;<\/p>\n<p>\tUPDATE order_milestones SET status_id = 80 WHERE status_id <> 50<br \/>\n\tAND order_id = v_order_id;<\/p>\n<p>\tUPDATE order_work_queue SET status = 80 WHERE status <> 50<br \/>\n\tAND order_id = v_order_id;<\/p>\n<p>\tUPDATE customer_order SET order_status = 5 WHERE order_status in ( 1, 2, 3 )<br \/>\n\tAND order_id = v_order_id;<\/p>\n<p>\tUPDATE order_lookup SET order_status = 5 WHERE order_status in ( 1, 2, 3 )<br \/>\n\tAND order_id = v_order_id;<\/p>\n<p>\tDELETE FROM order_dependency WHERE order_id = v_order_id<br \/>\n\tor dependent_upon_order_id = v_order_id;<\/p>\n<p>\tdelete from invd_order_dep c<br \/>\n\twhere c.order_id in (  v_order_id  );<\/p>\n<p>\tdelete from INVD_CHANGE c<br \/>\n\twhere c.order_id in (  v_order_id  );<\/p>\n<p>\tdelete from PEN_XFER_HISTORY px<br \/>\n\twhere px.order_id in (  v_order_id  );<\/p>\n<p>\tdelete from PEN_SWAP_HISTORY ps<br \/>\n\twhere ps.order_id in (  v_order_id  );<br \/>\n  COMMIT;<br \/>\n END;<br \/>\n\");<br \/>\nOCIExecute($stmt);<br \/>\nif ( $stmt ) echo \"Auftrag $order_id abgebrochen.\";<br \/>\n}<br \/>\nelseif ( $_REQUEST['action'] == 'check' && isset ( $_SESSION['arbor_user'] ) && isset ( $_SESSION['arbor_passwd'] ) && isset ( $_REQUEST['account_no'] ) )<br \/>\n{<br \/>\n$conn=OCILogon($_SESSION['arbor_user'], $_SESSION['arbor_passwd'], $db);<br \/>\n$sql=<br \/>\n\"<br \/>\n\tSELECT *<br \/>\n\tFROM CUSTOMER_ORDER@aom WHERE MASTER_ACCOUNT_NO = $_REQUEST[account_no] AND ORDER_STATUS NOT IN ( 4 , 5 )<br \/>\n\";<br \/>\n$stmt=OCIParse($conn, $sql);<br \/>\nOCIExecute($stmt);<br \/>\n$nrows = OCIFetchStatement($stmt,$results);<br \/>\nif ( $nrows > 0 ) {<br \/>\n   print \"<TABLE BORDER=\\\"1\\\">\\n\";<br \/>\n   print \"<TR>\\n\";<\/p>\n<p>   $external_id = $results['ORDER_ID'][0] ;<\/p>\n<p>   while ( list( $key, $val ) = each( $results ) ) {<br \/>\n      print \"<TH>$key<\/TH>\\n\";<br \/>\n   }<br \/>\n   print \"<\/TR>\\n\";<\/p>\n<p>   for ( $i = 0; $i < $nrows; $i++ ) {\n      reset($results);\n      print \"<TR>\\n\";<br \/>\n      while ( $column = each($results) ) {<br \/>\n         $data = $column['value'];<br \/>\n         print \"<TD>$data[$i]<\/TD>\\n\";<br \/>\n      }<br \/>\n      print \"<\/TR>\\n\";<br \/>\n   }<br \/>\n   print \"<\/TABLE>\\n\";<\/p>\n<p>?><\/p>\n<form method=\"POST\">\n<input type=\"hidden\" name=\"order_id\" value=\"<? echo $order_id ?>\"><br \/>\n<input type=\"hidden\" name=\"order_id_resets\" size=\"12\" value=\"<? echo $order_id_resets ?>\"><br \/>\n<input type=\"hidden\" name=\"external_id\" size=\"12\" value=\"<? echo $external_id ?>\"><br \/>\n<input type=\"submit\" name=\"action\" value=\"Externe ID rausl&ouml;schen\"><br \/>\n<\/form>\n<p><?\n\n} else {\n   echo \"No data found<BR>\\n\";<br \/>\n}<br \/>\nprint \"$nrows Record(s) Selected<BR>\\n\";<\/p>\n<p>OCIFreeStatement($stmt);<br \/>\nOCILogoff($conn);<br \/>\n?><\/p>\n<p><?php\n}\nelse\n{\n?><\/p>\n<form>\n<p>Arbor Login: <input type=\"text\" name=\"arbor_user\" size=\"12\"><\/p>\n<p>Passwort: <input type=\"password\" name=\"arbor_passwd\" size=\"12\"><\/p>\n<p>Account No.: <input type=\"text\" name=\"account_no\" size=\"12\"><\/p>\n<p><input type=\"submit\" name=\"action\" value=\"check\"><\/p>\n<\/form>\n<p><?php\n}\n?>\n<\/p>\n<\/div>\n<p><\/body><br \/>\n<\/html><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Test 2<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":0,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/89\/revisions"}],"wp:attachment":[{"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oliver-frick.ch\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}