Exemplo n.º 1
0
switch (strtolower($_POST['a'])) {
    case 'capture':
        Radix::redirect('/contact/capture?c=' . $c['id']);
        break;
    case 'create-account':
        $a = new Account();
        $a['kind'] = 'Sub: Customer';
        $a['code'] = $id;
        $a['name'] = $C['name'];
        $a['parent_id'] = $_ENV['account']['contact_ledger_container_id'];
        $a['active'] = 't';
        $a['link_to'] = 'contact';
        $a['link_id'] = $id;
        $a->save();
        $C['account_id'] = $a['id'];
        $C->save();
        Session::flash('fail', SQL::lastError());
        Session::flash('info', sprintf('Account #%d created', $a['id']));
        Radix::redirect('/contact/view?c=' . $C['id']);
        break;
    case 'delete':
        /*
        $c_so = $this->WorkOrder->findCount('WorkOrder.contact_id=' . $id);
        $c_iv = $this->Invoice->findCount('Invoice.contact_id=' . $id);
        
        if ( (($c_so == 0) && ($c_iv == 0)) || ($this->Session->read('Contact.delete_confirm')==true) ) {
        
        	$this->Contact->delete($id);
        
        	$this->Session->setFlash('Client deleted');
        	$this->Session->delete('Contact');
Exemplo n.º 2
0
switch (strtolower($_POST['a'])) {
    case 'capture':
        Radix::redirect('/contact/capture?c=' . $c['id']);
        break;
    case 'create-account':
        $a = new Account();
        $a['kind'] = 'Sub: Customer';
        $a['code'] = $id;
        $a['name'] = $c['name'];
        $a['parent_id'] = $_ENV['account']['contact_ledger_container_id'];
        $a['active'] = 't';
        $a['link_to'] = 'contact';
        $a['link_id'] = $id;
        $a->save();
        $c['account_id'] = $a['id'];
        $c->save();
        Session::flash('fail', SQL::lastError());
        Session::flash('info', sprintf('Account #%d Created', $a['id']));
        Radix::redirect('/contact/view?c=' . $c['id']);
        break;
    case 'delete':
        /*
        $c_so = $this->WorkOrder->findCount('WorkOrder.contact_id=' . $id);
        $c_iv = $this->Invoice->findCount('Invoice.contact_id=' . $id);
        
        if ( (($c_so == 0) && ($c_iv == 0)) || ($this->Session->read('Contact.delete_confirm')==true) ) {
        
        	$this->Contact->delete($id);
        
        	$this->Session->setFlash('Client deleted');
        	$this->Session->delete('Contact');