53 $this->_aViewData[
"edit"] = $oOrder;
54 $this->_aViewData[
"aProductVats"] = $oOrder->getProductVats(
true);
57 return "order_article.tpl";
68 if ($this->_oEditObject === null && isset($soxId) && $soxId !=
"-1") {
69 $this->_oEditObject =
oxNew(
"oxorder");
70 $this->_oEditObject->load($soxId);
93 if ($this->_oSearchProduct === null) {
94 $this->_oSearchProduct =
false;
98 if ($oProduct->oxarticles__oxartnum->value == $sSearchArtNum) {
99 $this->_oSearchProduct = $oProduct;
116 $this->_oMainSearchProduct =
false;
121 $sTable = getViewName(
"oxarticles");
122 $sQ =
"select oxid, oxparentid from $sTable where oxartnum = " . $oDb->quote($sArtNum) .
" limit 1";
124 $rs = $oDb->execute($sQ);
125 if ($rs !=
false && $rs->recordCount() > 0) {
126 $sArtId = $rs->fields[
'OXPARENTID'] ? $rs->fields[
'OXPARENTID'] : $rs->fields[
'OXID'];
128 $oProduct =
oxNew(
"oxarticle");
129 if ($oProduct->load($sArtId)) {
130 $this->_oMainSearchProduct = $oProduct;
145 if ($this->_oSearchProductList === null) {
146 $this->_oSearchProductList =
oxNew(
"oxlist");
151 $this->_oSearchProductList->offsetSet($oMainSearchProduct->getId(), $oMainSearchProduct);
154 foreach ($oMainSearchProduct->getVariants() as $oVariant) {
155 $this->_oSearchProductList->offsetSet($oVariant->getId(), $oVariant);
170 $oProduct =
oxNew(
"oxarticle");
172 if ($sOxid && $dAmount && $oProduct->load($sOxid)) {
175 $oOrder =
oxNew(
'oxorder');
176 if ($sOrderId && $oOrder->load($sOrderId)) {
177 $oOrderArticle =
oxNew(
'oxorderArticle');
178 $oOrderArticle->oxorderarticles__oxartid =
new oxField($oProduct->getId());
179 $oOrderArticle->oxorderarticles__oxartnum =
new oxField($oProduct->oxarticles__oxartnum->value);
180 $oOrderArticle->oxorderarticles__oxamount =
new oxField($dAmount);
182 $oOrder->recalculateOrder(array($oOrderArticle));
196 $oOrderArticle =
oxNew(
'oxorderarticle');
197 $oOrder =
oxNew(
'oxorder');
200 if ($oOrderArticle->load($sOrderArtId) && $oOrder->load($sOrderId)) {
204 $oOrderArticle->delete();
207 $oOrder->recalculateOrder();
219 $oArticle =
oxNew(
'oxorderarticle');
220 $oArticle->load($sOrderArtId);
222 if ($oArticle->oxorderarticles__oxstorno->value == 1) {
223 $oArticle->oxorderarticles__oxstorno->setValue(0);
226 $oArticle->oxorderarticles__oxstorno->setValue(1);
231 if (
$myConfig->getConfigParam(
'blUseStock')) {
232 $oArticle->updateArticleStock($oArticle->oxorderarticles__oxamount->value * $sStockSign,
$myConfig->getConfigParam(
'blAllowNegativeStock'));
236 $sQ =
"update oxorderarticles set oxstorno = " . $oDb->quote($oArticle->oxorderarticles__oxstorno->value) .
" where oxid = " . $oDb->quote($sOrderArtId);
240 $sQ =
"select oxartid from oxorderarticles where oxid = " . $oDb->quote($sOrderArtId);
241 if (($sArtId =
oxDb::getDb()->getOne($sQ,
false,
false))) {
242 $oOrder =
oxNew(
'oxorder');
243 if ($oOrder->load($this->getEditObjectId())) {
244 $oOrder->recalculateOrder();
256 $oOrder =
oxNew(
'oxorder');
257 if (is_array($aOrderArticles) && $oOrder->load($this->getEditObjectId())) {
260 $oOrderArticles = $oOrder->getOrderArticles(
true);
262 $blUseStock =
$myConfig->getConfigParam(
'blUseStock');
263 foreach ($oOrderArticles as $oOrderArticle) {
264 $sItemId = $oOrderArticle->getId();
265 if (isset($aOrderArticles[$sItemId])) {
269 $oOrderArticle->setNewAmount($aOrderArticles[$sItemId][
'oxamount']);
271 $oOrderArticle->assign($aOrderArticles[$sItemId]);
272 $oOrderArticle->save();
278 $oOrder->recalculateOrder();