<commit_before><?php

class page_accounts_Default extends Page {
	function init(){
		parent::init();

		$crud=$this->add('xCRUD');
		$account_Default_model = $this->add('Model_Account_Default');
		$account_Default_model->add('Controller_Acl');
		$account_Default_model->setOrder('id','desc');

		$crud->addHook('myupdate',function($crud,$form){
			if($crud->isEditing('edit')) return false;
			
			$Default_account_model = $crud->add('Model_Account_Default');			
			try {
				$crud->api->db->beginTransaction();
			    $Default_account_model->createNewAccount($form['member_id'],$form['scheme_id'],$crud->api->current_branch, $form['AccountNumber'],$form->getAllFields(),$form);
			    $crud->api->db->commit();
			} catch (Exception $e) {
			   	$crud->api->db->rollBack();
			   	throw $e;
			}
			return true;
		});

		if($crud->isEditing("add")){
		    $o=$crud->form->add('Order');
			$k = 2;
			for($k=2;$k<=4;$k++) {
			    $f=$crud->form->addField('autocomplete/Basic','member_ID'.$k);
			   	$f->setModel('Member');
			   	$o->move($f->other_field,'before','Nominee');
			}

		}

		if($crud->isEditing('edit')){
			$account_Default_model->hook('editing');
		}

		$crud->setModel($account_Default_model,array('AccountNumber','member_id','scheme_id','agent_id','ActiveStatus'),array('AccountNumber','member','scheme','agent','ActiveStatus'));
		
		if($crud->grid){
			$crud->grid->addPaginator(10);
			$crud->grid->addOrder()->move('member','first')->now();
		}

		if($crud->isEditing('add')){
			// $o->move('initial_opening_amount','before','Amount')
			// ->now();<commit_msg>Default accounts now not having shared capital, no more multiple members in default account<commit_after><?php

class page_accounts_Default extends Page {
	function init(){
		parent::init();

		$crud=$this->add('xCRUD');
		$account_Default_model = $this->add('Model_Account_Default');
		$account_Default_model->addCondition('scheme_name','<>','Share Capital');
		$account_Default_model->add('Controller_Acl');
		$account_Default_model->setOrder('id','desc');

		$crud->addHook('myupdate',function($crud,$form){
			if($crud->isEditing('edit')) return false;
			
			$Default_account_model = $crud->add('Model_Account_Default');			
			try {
				$crud->api->db->beginTransaction();
			    $Default_account_model->createNewAccount($form['member_id'],$form['scheme_id'],$crud->api->current_branch, $form['AccountNumber'],$form->getAllFields(),$form);
			    $crud->api->db->commit();
			} catch (Exception $e) {
			   	$crud->api->db->rollBack();
			   	throw $e;
			}
			return true;
		});

		if($crud->isEditing("add")){
		    $o=$crud->form->add('Order');
			// $k = 2;
			// for($k=2;$k<=4;$k++) {
			//     $f=$crud->form->addField('autocomplete/Basic','member_ID'.$k);
			//    	$f->setModel('Member');
			//    	$o->move($f->other_field,'before','Nominee');
			// }

		}

		if($crud->isEditing('edit')){
			$account_Default_model->hook('editing');
		}

		$crud->setModel($account_Default_model,array('AccountNumber','member_id','scheme_id','ActiveStatus'),array('AccountNumber','member','scheme','ActiveStatus'));
		
		if($crud->grid){
			$crud->grid->addPaginator(10);
			$crud->grid->addOrder()->move('member','first')->now();
		}

		if($crud->isEditing()){
			$m = $crud->form->getElement('scheme_id')->getModel();
			$m->addCondition('SchemeType',ACCOUNT_TYPE_DEFAULT);
			$m->addCondition('name','<>','Share Capital');
			$m->addCondition('published',true);
		}

		if($crud->isEditing('add')){
			// $o->move('initial_opening_amount','before','Amount')
			// ->now();
{'fraction_non_alphanumeric': 0.2337735318909806, 'fraction_numerical': 0.0028097780275358245, 'mean_word_length': 5.013513513513513, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1276782', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1232, 'n_words': 119}