public function devisConvertToStoreOrder($id)
{
+ $r = Bootstrap::getInstance()->getDb()->select()->from('devis')->where('id = ?', $id)->query()->fetch();
+
$db = $this->getDb();
$bind['type'] = 'MAG';
$bind['date_reponse'] = $bind['date_paiement'] = $_POST['date'];
$bind['methode_paiement'] = $_POST['methode_paiement'];
$bind['status'] = DTLC_Form_Devis::PAYE;
+ $bind['secret'] = $r->secret ?: md5(rand(100000000, 999999999));
$db->compliantUpdate('devis', $bind, $db->quoteInto('id = ?', $id));
- $r = Bootstrap::getInstance()->getDb()->select()->from('devis')->where('id = ?', $id)->query()->fetch();
-
$this->_datas->addClosePopup();
- $this->_datas->addRedirection('/devis/index/' . $id . '/' . $r->secret);
+ $this->_datas->addRedirection('/devis/index/' . $id . '/' . $bind['secret']);
}
}
protected function _actionStore($r, $view)
{
- if ($r['status'] > 1) {
+ if ($r['status'] != 1) {
return;
}
return $view->linkPopup($view->imageSilk('cart'), '/admin/ajaxpopup/devisConvertToStoreOrder/' . $r['id'], array('title' => 'Convertir en facture magasin'));