Changeset 1432
- Timestamp:
- 02/21/12 17:24:55 (3 months ago)
- Location:
- modules/money
- Files:
-
- 8 edited
-
includes/dbquery.php (modified) (1 diff)
-
includes/manager.php (modified) (2 diffs)
-
js/accountlist.css (modified) (1 diff)
-
js/accountlist.htm (modified) (1 diff)
-
js/accountlist.js (modified) (9 diffs)
-
js/groupview.htm (modified) (2 diffs)
-
js/groupview.js (modified) (5 diffs)
-
js/lib.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modules/money/includes/dbquery.php
r1431 r1432 170 170 INNER JOIN ".$db->prefix."money_account a ON a.accountid=ur.accountid 171 171 INNER JOIN ".$db->prefix."money_group g ON g.groupid=a.groupid 172 WHERE g.deldate=0 AND ur.userid=".bkint($userid)." AND ur.role>0172 WHERE g.deldate=0 AND a.deldate=0 AND ur.userid=".bkint($userid)." AND ur.role>0 173 173 ".($groupid>0?" AND a.groupid=".bkint($groupid):"")." 174 174 ".($accountid>0?" AND a.accountid=".bkint($accountid):"")." -
modules/money/includes/manager.php
r1431 r1432 49 49 case 'groupremove': return $this->GroupRemove($d->groupid); 50 50 case 'accountsave': return $this->AccountSave($d->account); 51 case 'accountremove': return $this->AccountRemove($d->accountid); 51 52 case 'opersave': return $this->OperSave($d->oper); 52 53 case 'operremove': return $this->OperRemove($d->operid); … … 213 214 if (!$this->IsWriteRole()){ return null; } 214 215 $dbAccount = MoneyQuery::Account($this->db, $this->userid, $accountid); 215 if (empty($dbAccount)){ return null; } 216 217 if ($dbAccount['r'] != MoneyAccountRole::ADMIN){ return null; } 216 217 if (empty($dbAccount) || $dbAccount['r'] != MoneyAccountRole::ADMIN){ return null; } 218 218 219 219 MoneyQuery::AccountRemove($this->db, $accountid); 220 return $accountid; 220 221 $ret = new stdClass(); 222 $ret->deldate = TIMENOW; 223 return $ret; 221 224 } 222 225 -
modules/money/js/accountlist.css
r1431 r1432 96 96 background: url("/modules/botask/images/icons001.png") no-repeat scroll -29px -24px transparent; 97 97 } 98 .aw-money .aclist .arow .amenu .brem { 99 background: url("/modules/money/images/icons001.png") no-repeat scroll -42px -24px transparent; 100 } 101 102 98 103 .aw-money .aclist .arow .amenu .bc { 99 104 height: 14px; -
modules/money/js/accountlist.htm
r1431 r1432 54 54 <div id="{i#baddc}" class="badd bc"> </div> 55 55 </div> 56 <div id="{i#brem}" class="b" title="Удалить счет"> 57 <div id="{i#bremc}" class="brem bc"> </div> 58 </div> 56 59 </div> 57 60 </div> -
modules/money/js/accountlist.js
r1431 r1432 96 96 case tp['badd']: 97 97 case tp['baddc']: this.onMenuAddOperClick(); return true; 98 99 case tp['brem']: 100 case tp['bremc']: this.onMenuRemoveClick(); return true; 98 101 } 99 102 … … 124 127 if (!acc.isEditRole()){ 125 128 Dom.setStyle(gel('bedit'), 'display', 'none'); 129 Dom.setStyle(gel('brem'), 'display', 'none'); 126 130 } 127 131 if (!acc.isOperRole()){ … … 131 135 onMenuEditClick: function(){ 132 136 NS.life(this.cfg['onEditCallback'], this); 137 }, 138 onMenuRemoveClick: function(){ 139 NS.life(this.cfg['onRemoveCallback'], this); 133 140 }, 134 141 onMenuAddOperClick: function(){ … … 193 200 'onEditCallback': function(row){ 194 201 __self.onMenuEditClick(row); 202 }, 203 'onRemoveCallback': function(row){ 204 __self.onMenuRemoveClick(row); 195 205 }, 196 206 'onAddOperCallback': function(row){ … … 235 245 NS.life(this.cfg['onEditCallback'], row); 236 246 }, 247 onMenuRemoveClick: function(row){ 248 NS.life(this.cfg['onRemoveCallback'], row); 249 }, 237 250 onSelectByClick: function(rowWidget){ 238 251 NS.life(this.cfg['onSelCallback'], rowWidget); … … 268 281 this.clickGroupEditEvent = new CE('clickGroupEditEvent'); 269 282 this.clickEditEvent = new CE('clickEditEvent'); 283 this.clickRemoveEvent = new CE('clickRemoveEvent'); 270 284 this.clickGroupRemoveEvent = new CE('clickGroupRemoveEvent'); 271 285 … … 279 293 'onEditCallback': function(row){ 280 294 __self.onClickEdit(row.account); 295 }, 296 'onRemoveCallback': function(row){ 297 __self.onClickRemove(row.account); 281 298 }, 282 299 'onSelCallback': function(row){ … … 370 387 }, 371 388 selectAccount: function(account){ 372 this.selectAccountById(account.id); 389 if (L.isNull(account)){ 390 this.selectAccountById(null); 391 }else{ 392 this.selectAccountById(account.id); 393 } 373 394 }, 374 395 selectAccountById: function(accountid){ … … 397 418 this.clickEditEvent.fire(acc); 398 419 }, 420 onClickRemove: function(acc){ 421 this.clickRemoveEvent.fire(acc); 422 }, 399 423 onClickGroupRemove: function(){ 400 424 this.clickGroupRemoveEvent.fire(this.group); -
modules/money/js/groupview.htm
r1431 r1432 40 40 </div> 41 41 42 <!--{accremovepanel}--> 43 <div class='hd'>Удаление бухгалтерии</div> 44 <div class='bd aw-money'> 45 <div id="{i#dialogremove}" class="field"> 46 <h4>Удаление бухгалтерии</h4> 47 <p> 48 Внимание! <br /> 49 Вы действительно хотите удалить счет "{v#tl}" и все что с ним связано? 50 </p> 51 <div class="buttons right"> 52 <span id="{i#btns}"> 53 <input id="{i#bremove}" value="Подтверждаю" type="button" /> 54 <input id="{i#bcancel}" value="Отмена" type="button" /> 55 </span> 56 <span id="{i#bloading}" style="display: none"> 57 <img src="/images/loading.gif" /> Удаление... 58 </span> 59 </div> 60 </div> 61 </div> 62 42 63 <!--{groupremovepanel}--> 43 64 <div class='hd'>Удаление бухгалтерии</div> … … 60 81 </div> 61 82 </div> 62 63 83 64 84 <!--{orempanel}--> -
modules/money/js/groupview.js
r1431 r1432 55 55 this.accountsWidget.clickCreateEvent.subscribe(this.onAccountsClickCreate, this, true); 56 56 this.accountsWidget.clickEditEvent.subscribe(this.onAccountsClickEdit, this, true); 57 this.accountsWidget.clickRemoveEvent.subscribe(this.onAccountsClickRemove, this, true); 57 58 58 59 this.operLogWidget = new NS.OperLogWidget(gel('operlog'), group); … … 64 65 }; 65 66 66 var acc = group.accounts.getByIndex(0); 67 this.accountsWidget.selectAccount(acc); 67 this.setFirstAccount(); 68 68 }, 69 69 destroy: function(){ 70 70 if(this.accountsWidget){ 71 71 this.accountsWidget.selectChangedEvent.unsubscribe(this.onAccountsSelectChanged); 72 this.accountsWidget.clickGroupEditEvent.unsubscribe(this.onAccountsClickGroupEdit); 73 this.accountsWidget.clickGroupRemoveEvent.unsubscribe(this.onAccountsClickGroupRemove); 72 74 this.accountsWidget.clickCreateEvent.unsubscribe(this.onAccountsClickCreate); 75 this.accountsWidget.clickEditEvent.unsubscribe(this.onAccountsClickEdit); 76 this.accountsWidget.clickRemoveEvent.unsubscribe(this.onAccountsClickRemove); 73 77 this.accountsWidget.destroy(); 74 78 … … 87 91 el.parentNode.removeChild(el); 88 92 }, 93 setFirstAccount: function(){ 94 var acc = this.group.accounts.getByIndex(0); 95 this.accountsWidget.selectAccount(acc); 96 return acc; 97 }, 89 98 onAccountsClickCreate: function(){ 90 99 this.showAccountEditor(0); … … 93 102 var account = prm[0]; 94 103 this.showAccountEditor(account.id); 104 }, 105 onAccountsClickRemove: function(evt, prm){ 106 var account = prm[0], __self = this; 107 new AccountRemovePanel(account, function(){ 108 var acc = __self.setFirstAccount(); 109 if (L.isNull(acc)){ 110 Brick.Page.reload(NS.navigator.ws); 111 } 112 }); 95 113 }, 96 114 onAccountsClickGroupEdit: function(evt, prm){ … … 197 215 NS.GroupViewWidget = GroupViewWidget; 198 216 217 var AccountRemovePanel = function(account, callback){ 218 this.account = account; 219 this.callback = callback; 220 AccountRemovePanel.superclass.constructor.call(this, {fixedcenter: true}); 221 }; 222 YAHOO.extend(AccountRemovePanel, Brick.widget.Dialog, { 223 initTemplate: function(){ 224 return buildTemplate(this, 'accremovepanel').replace('accremovepanel', { 225 'tl': this.account.getTitle() 226 }); 227 }, 228 onClick: function(el){ 229 var tp = this._TId['accremovepanel']; 230 switch(el.id){ 231 case tp['bcancel']: this.close(); return true; 232 case tp['bremove']: this.accRemove(); return true; 233 } 234 return false; 235 }, 236 accRemove: function(){ 237 var TM = this._TM, gel = function(n){ return TM.getEl('accremovepanel.'+n); }, 238 __self = this; 239 Dom.setStyle(gel('btns'), 'display', 'none'); 240 Dom.setStyle(gel('bloading'), 'display', ''); 241 242 NS.moneyManager.accountRemove(this.account.id, function(){ 243 __self.close(); 244 NS.life(__self.callback); 245 }); 246 } 247 }); 248 NS.AccountRemovePanel = AccountRemovePanel; 249 199 250 var GroupRemovePanel = function(group, callback){ 200 251 this.group = group; -
modules/money/js/lib.js
r1431 r1432 668 668 var ad = r['account']; 669 669 group = __self.groups.get(ad['gid']); 670 670 671 if (!L.isNull(group)){ 671 672 group.accounts.update([ad]); … … 684 685 }, 685 686 accountRemove: function(accountid, callback){ 687 var account = this.findAccount(accountid); 688 if (L.isNull(account)){ return; } 689 var group = this.groups.get(account.groupid); 690 686 691 var __self = this; 687 692 this.ajax({ … … 690 695 }, function(r){ 691 696 if (!L.isNull(r) && r['deldate']>0){ 692 __self.onAccountRemoved(accountid); 697 group.accounts.remove(accountid); 698 if (group.accounts.count() == 0){ 699 __self.groups.remove(group.id); 700 __self.onGroupRemoved(group.id); 701 }else{ 702 __self.onAccountRemoved(accountid); 703 } 693 704 } 694 705 NS.life(callback);
Note: See TracChangeset
for help on using the changeset viewer.
