retrieve($_GET['correct_id']); $n=new EcmStockDocIn(); $arr=array("name","desciption","parent_id","type","status","register_date","validtill_date","parent_contact_name","parent_contact_title","parent_address_street","parent_address_city","parent_address_postalcode","parent_address_country","subtotal","total","discount","to_vatid","ecmlanguage","to_is_vat_free","header_text","footer_text","ads_text","template_id","template_name","contact_id","accepted","email_id","order_origin","show_images_on_offers","stock_id","pdflanguages","assigned_user_id"); foreach($arr as $f){ $n->$f=$focus->$f; } $n->position_list=$focus->getPositionList(true); $n->type="1"; $n->correct_id=$_GET['correct_id']; $return_id=$n->saveCorrect(); $ww=$GLOBALS['db']->query("select id from ecmstockdocinitems where ecmstockdocin_id='".$_GET['correct_id']."' and deleted='0'"); while($rr=$GLOBALS['db']->fetchByAssoc($ww)){ $w=$GLOBALS['db']->query("select * from ecmstockoperations where parent_type='EcmStockDocIns' and parent_id='".$_GET['correct_id']."' and documentitem_id='".$rr['id']."'"); while($r=$GLOBALS['db']->fetchByAssoc($w)){ $focus->addProductToStockOut($r['id'],$r['product_id'],$r['quantity'],$r['price'],date("Y-m-d H:i:s"),$return_id,$n->stock_id,$rr['id']); } } header("Location: index.php?module=EcmStockDocIns&action=DetailView&record=".$return_id); ?>