Changeset 22477 for branches/version-2_12-dev
- Timestamp:
- 2013/01/30 16:51:27 (11 years ago)
- Location:
- branches/version-2_12-dev/data
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/Smarty/templates/admin/basis/index.tpl
r22206 r22477 111 111 <form name="form1" id="form1" method="post" action="?"> 112 112 <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 113 <input type="hidden" name="mode" value=" <!--{$tpl_mode}-->" />113 <input type="hidden" name="mode" value="confirm" /> 114 114 <!--{* ▼登録テーブルここから *}--> 115 115 <div id="basis" class="contents-main"> … … 323 323 <div class="btn-area"> 324 324 <ul> 325 <li><a class="btn-action" href="javascript:;" onclick="fnFormModeSubmit('form1', ' <!--{$tpl_mode}-->', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li>325 <li><a class="btn-action" href="javascript:;" onclick="fnFormModeSubmit('form1', 'confirm', '', ''); return false;"><span class="btn-next">この内容で登録する</span></a></li> 326 326 </ul> 327 327 </div> -
branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php
r22218 r22477 1468 1468 return $exists; 1469 1469 } 1470 1471 /** 1472 * 店舗基本情報を登録する 1473 * 1474 * @param array $arrData 登録するデータ 1475 * @return void 1476 */ 1477 static function registerBasisData($arrData) { 1478 $objQuery =& SC_Query_Ex::getSingletonInstance(); 1479 1480 $arrData = $objQuery->extractOnlyColsOf('dtb_baseinfo', $arrData); 1481 1482 if (isset($arrData['regular_holiday_ids']) && is_array($arrData['regular_holiday_ids'])) { 1483 // 定休日をパイプ区切りの文字列に変換 1484 $arrData['regular_holiday_ids'] = implode('|', $arrData['regular_holiday_ids']); 1485 } 1486 1487 $arrData['update_date'] = 'CURRENT_TIMESTAMP'; 1488 1489 // UPDATEの実行 1490 $ret = $objQuery->update('dtb_baseinfo', $arrData); 1491 GC_Utils_Ex::gfPrintLog('dtb_baseinfo に UPDATE を実行しました。'); 1492 1493 // UPDATE できなかった場合、INSERT 1494 if ($ret == 0) { 1495 $arrData['id'] = 1; 1496 $ret = $objQuery->insert('dtb_baseinfo', $arrData); 1497 GC_Utils_Ex::gfPrintLog('dtb_baseinfo に INSERT を実行しました。'); 1498 } 1499 } 1470 1500 } -
branches/version-2_12-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php
r22472 r22477 79 79 */ 80 80 function action() { 81 82 81 $objDb = new SC_Helper_DB_Ex(); 83 82 84 if ($objDb->sfGetBasisExists()) { 85 $this->tpl_mode = 'update'; 86 } else { 87 $this->tpl_mode = 'insert'; 88 } 89 90 if (!empty($_POST)) { 91 83 $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "');"; 84 85 if ($this->getMode() === 'confirm') { 92 86 $objFormParam = new SC_FormParam_Ex(); 93 87 $this->lfInitParam($objFormParam, $_POST); … … 96 90 97 91 $this->arrErr = $this->lfCheckError($objFormParam); 98 $post = $objFormParam->getHashArray(); 99 100 $this->arrForm = $post; 101 102 if (count($this->arrErr) == 0) { 103 switch ($this->getMode()) { 104 // 既存編集 105 case 'update': 106 $this->lfUpdateData($this->arrForm); 107 break; 108 // 新規作成 109 case 'insert': 110 $this->lfInsertData($this->arrForm); 111 break; 112 default: 113 break; 114 } 115 $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "'); window.alert('SHOPマスターの登録が完了しました。');"; 92 93 if (!empty($this->arrErr)) { 94 $this->arrForm = $objFormParam->getHashArray(); 95 return; 116 96 } 117 if (empty($this->arrForm['regular_holiday_ids'])) { 118 $this->arrSel = array(); 119 } else { 120 $this->arrSel = $this->arrForm['regular_holiday_ids']; 121 } 122 } else { 123 $arrCol = $this->lfGetCol(); 124 $col = SC_Utils_Ex::sfGetCommaList($arrCol); 125 $arrRet = $objDb->sfGetBasisData(true, $col); 126 $this->arrForm = $arrRet; 127 128 $regular_holiday_ids = explode('|', $this->arrForm['regular_holiday_ids']); 129 $this->arrForm['regular_holiday_ids'] = $regular_holiday_ids; 130 $this->tpl_onload = "fnCheckLimit('downloadable_days', 'downloadable_days_unlimited', '" . DISABLED_RGB . "');"; 97 98 $arrData = $objFormParam->getDbArray(); 99 SC_Helper_DB_Ex::registerBasisData($arrData); 100 101 $this->tpl_onload .= "window.alert('SHOPマスターの登録が完了しました。');"; 131 102 } 132 103 104 $arrRet = $objDb->sfGetBasisData(true); 105 $objFormParam->setParam($arrRet); 106 $this->arrForm = $objFormParam->getHashArray(); 107 $this->arrForm['regular_holiday_ids'] = explode('|', $this->arrForm['regular_holiday_ids']); 133 108 } 134 109 … … 142 117 } 143 118 144 // 基本情報用のカラムを取り出す。 145 function lfGetCol() { 146 $arrCol = array( 147 'company_name', 148 'company_kana', 149 'shop_name', 150 'shop_kana', 151 'shop_name_eng', 152 'zip01', 153 'zip02', 154 'pref', 155 'addr01', 156 'addr02', 157 'tel01', 158 'tel02', 159 'tel03', 160 'fax01', 161 'fax02', 162 'fax03', 163 'business_hour', 164 'email01', 165 'email02', 166 'email03', 167 'email04', 168 'tax', 169 'tax_rule', 170 'free_rule', 171 'good_traded', 172 'message', 173 'regular_holiday_ids', 174 'latitude', 175 'longitude', 176 'downloadable_days', 177 'downloadable_days_unlimited' 178 ); 179 return $arrCol; 180 } 181 182 function lfUpdateData($array) { 183 $objQuery =& SC_Query_Ex::getSingletonInstance(); 184 $arrCol = $this->lfGetCol(); 185 foreach ($arrCol as $val) { 186 //配列の場合は、パイプ区切りの文字列に変換 187 if (is_array($array[$val])) { 188 $sqlval[$val] = implode('|', $array[$val]); 189 } else { 190 $sqlval[$val] = $array[$val]; 191 } 192 } 193 $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; 194 // UPDATEの実行 195 $ret = $objQuery->update('dtb_baseinfo', $sqlval); 196 197 GC_Utils_Ex::gfPrintLog('dtb_baseinfo に UPDATE を実行しました。'); 198 } 199 200 function lfInsertData($array) { 201 $objQuery =& SC_Query_Ex::getSingletonInstance(); 202 $arrCol = $this->lfGetCol(); 203 foreach ($arrCol as $val) { 204 $sqlval[$val] = $array[$val]; 205 } 206 $sqlval['id'] = 1; 207 $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; 208 // INSERTの実行 209 $ret = $objQuery->insert('dtb_baseinfo', $sqlval); 210 211 GC_Utils_Ex::gfPrintLog('dtb_baseinfo に INSERT を実行しました。'); 119 /** 120 * 前方互換用 121 * 122 * @deprecated 2.12.4 123 */ 124 function lfUpdateData($arrData) { 125 trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); 126 SC_Helper_DB_Ex::registerBasisData($arrData); 127 } 128 129 /** 130 * 前方互換用 131 * 132 * @deprecated 2.12.4 133 */ 134 function lfInsertData($arrData) { 135 trigger_error('前方互換用メソッドが使用されました。', E_USER_WARNING); 136 SC_Helper_DB_Ex::registerBasisData($arrData); 212 137 } 213 138
Note: See TracChangeset
for help on using the changeset viewer.