|
From: Verdon V. <ve...@us...> - 2008-12-03 20:38:03
|
Update of /cvsroot/phpwebsite-comm/modules/vshop/class In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23489/class Modified Files: vShop.php vShop_Forms.php vShop_Order.php Log Message: added ability to quick-edit order status Index: vShop.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** vShop.php 2 Dec 2008 19:43:15 -0000 1.2 --- vShop.php 3 Dec 2008 20:37:49 -0000 1.3 *************** *** 290,293 **** --- 290,317 ---- $this->loadForm('orders'); break; + + case 'set_status': + if (!Current_User::authorized('vshop', 'edit_orders')) { + Current_User::disallow(); + } + $this->loadOrder(); + PHPWS_Core::initModClass('vshop', 'vShop_Forms.php'); + $content = vShop_Forms::setStatus($this->order); + Layout::nakedDisplay($content); + break; + + case 'update_status': + if (!Current_User::authorized('vshop', 'edit_orders')) { + Current_User::disallow(); + } + $this->loadOrder(); + $this->order->status = (int)$_POST['status']; + $this->order->save(); + $this->forwardMessage(sprintf(dgettext('vshop', 'Order %s status updated.'), $this->order->id)); + $url = 'index.php?module=vshop&aop=menu&tab=orders'; + $js['location'] = $url; + javascript('close_refresh', $js); + break; + *************** *** 583,586 **** --- 607,611 ---- $this->forms = new vShop_Forms; $this->forms->vshop = & $this; + //print_r($this->forms->vshop); exit; $this->forms->get($type); } *************** *** 1316,1319 **** --- 1341,1345 ---- + } ?> \ No newline at end of file Index: vShop_Order.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop_Order.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** vShop_Order.php 25 Nov 2008 15:19:30 -0000 1.1.1.1 --- vShop_Order.php 3 Dec 2008 20:37:49 -0000 1.2 *************** *** 405,409 **** $tpl['ORDERED'] = $this->getOrder_date(true); $tpl['UPDATED'] = $this->getUpdate_date(true); ! $tpl['STATUS'] = $this->getStatus(true); if($links) --- 405,423 ---- $tpl['ORDERED'] = $this->getOrder_date(true); $tpl['UPDATED'] = $this->getUpdate_date(true); ! ! if (javascriptEnabled()) { ! $js_vars['label'] = $this->getStatus(true); ! $js_vars['width'] = 400; ! $js_vars['height'] = 250; ! ! $vars['aop'] = 'set_status'; ! ! $js_vars['address'] = PHPWS_Text::linkAddress('vshop', $vars, true); ! $link = javascript('open_window', $js_vars); ! ! $tpl['STATUS'] = $link; ! } else { ! $tpl['STATUS'] = $this->getStatus(true); ! } if($links) Index: vShop_Forms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/vshop/class/vShop_Forms.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** vShop_Forms.php 2 Dec 2008 19:43:15 -0000 1.2 --- vShop_Forms.php 3 Dec 2008 20:37:49 -0000 1.3 *************** *** 78,82 **** case 'edit_order': ! if (empty($this->vshop->edit_order)) { $this->vshop->loadOrder(); } --- 78,82 ---- case 'edit_order': ! if (empty($this->vshop->order)) { $this->vshop->loadOrder(); } *************** *** 84,87 **** --- 84,95 ---- break; + case 'set_status': + if (empty($this->vshop->order)) { + $this->vshop->loadOrder(); + } + //print_r($this->vshop->order); exit; + $this->setStatus(); + break; + case 'orders': $this->vshop->panel->setCurrentTab('orders'); *************** *** 487,490 **** --- 495,520 ---- + public function setStatus($order) + { + + $form = new PHPWS_Form('set_status'); + require PHPWS_SOURCE_DIR . 'mod/vshop/inc/statuses.php'; + $form->addHidden('module', 'vshop'); + $form->addHidden('aop', 'update_status'); + $form->addHidden('order_id', $order->id); + $form->addSelect('status', $statuses); + $form->setMatch('status', $order->status); + $form->setLabel('status', sprintf(dgettext('vshop', 'Order %s status'), $order->id)); + $form->addSubmit(dgettext('vshop', 'Update')); + + $tpl = $form->getTemplate(); + $tpl['TITLE'] = sprintf(dgettext('vshop', 'Order %s Status'), $order->id); + $tpl['CLOSE'] = sprintf('<input type="button" value="%s" onclick="window.close();" />', dgettext('vshop', 'Cancel')); + $content = PHPWS_Template::process($tpl, 'vshop', 'set_status.tpl'); + + return $content; + } + + public function editSettings() { |