Ejemplo n.º 1
0
     break;
     //when user request to edit particular organization
 //when user request to edit particular organization
 case "view":
     if ($o->fetchBPartner($o->bpartner_id)) {
         $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y');
         $o->viewBpartnerInfo();
         $tokenadd = $s->createToken($tokenlife, "CREATE_ADD");
         $tokencontacts = $s->createToken($tokenlife, "CREATE_CONTACTS");
         include_once "class/Address.php.inc";
         include_once "class/Contacts.php.inc";
         $add = new Address();
         $contacts = new Contacts();
         $add->showAddressTable($o->bpartner_id, "WHERE ad.bpartner_id={$o->bpartner_id}", "ORDER BY ad.defaultlevel,ad.address_name", $tokenadd);
         echo "<BR>";
         $contacts->showContactsTable($o->bpartner_id, "WHERE c.bpartner_id={$o->bpartner_id}", "ORDER BY c.defaultlevel,c.contacts_name", $tokencontacts);
     } else {
         //if can't find particular organization from database, return error message
         redirect_header("bpartner.php", 3, "Some error on viewing your bpartner data, probably database corrupted");
     }
     break;
 case "edit":
     if ($o->fetchBPartner($o->bpartner_id)) {
         //		if($o->bpartnergroup_id > 0){
         //		$account_type = $o->getAccountType($o->bpartnergroup_id);
         //		$whereaccount = " and account_type =  $account_type ";
         //		}else
         //		$whereaccount = "";
         //create a new token for editing a form
         $token = $s->createToken($tokenlife, "CREATE_BPARTNER");
         $o->orgctrl = $ctrl->selectionOrg($o->createdby, $o->organization_id, 'N', "", 'Y');
Ejemplo n.º 2
0
        } else {
            $log->saveLog($o->contacts_id, $tablecontacts, $o->updatesql, "U", "F");
            redirect_header("contacts.php?action=edit&contacts_id={$o->contacts_id}", $pausetime, "Warning! Can't save the data, please make sure all value is insert properly.");
        }
        break;
    case "delete":
        if ($s->check(true, $token, "CREATE_CONTACTS")) {
            if ($o->deleteContacts($o->contacts_id)) {
                $log->saveLog($o->contacts_id, $tablecontacts, $o->updatesql, "D", "O");
                redirect_header("bpartner.php?action=view&bpartner_id={$o->bpartner_id}", $pausetime, "Data removed successfully.");
            } else {
                $log->saveLog($o->contacts_id, $tablecontacts, $o->updatesql, "D", "F");
                redirect_header("contacts.php?action=edit&contacts_id={$o->contacts_id}", $pausetime, "Warning! Can't delete data from database.");
            }
        } else {
            $log->saveLog($o->contacts_id, $tablecontacts, $o->updatesql, "D", "F");
            redirect_header("contacts.php?action=edit&contacts_id={$o->contacts_id}", $pausetime, "Warning! Can't delete data from database.");
        }
    default:
        $token = $s->createToken($tokenlife, "CREATE_CONTACTS");
        $o->orgctrl = $ctrl->selectionOrg($o->createdby, $defaultorganization_id, 'N', "", 'Y');
        $o->sellaccountsctrl = $ctrl->getSelectAccounts($o->defaultsellaccount_id, 'Y', "", "defaultsellaccount_id", "AND placeholder=0");
        $o->buyaccountsctrl = $ctrl->getSelectAccounts($o->defaultbuyaccount_id, 'Y', "", "defaultbuyaccount_id", "AND placeholder=0");
        $o->issueaccountsctrl = $ctrl->getSelectAccounts($o->defaultissueaccount_id, 'Y', "", "defaultissueaccount_id", "AND placeholder=0");
        $o->stockadjustaccountsctrl = $ctrl->getSelectAccounts($o->defaultstockadjustaccount_id, 'Y', "", "defaultstockadjustaccount_id", "AND placeholder=0");
        $o->getInputForm("new", 0, $token);
        $o->showContactsTable("WHERE contacts_id>0 and organization_id={$defaultorganization_id}", "ORDER BY defaultlevel,contacts_name");
        break;
}
echo '</td>';
require XOOPS_ROOT_PATH . '/footer.php';