Esempio n. 1
0
        exit;
    }
}
if (isset($_POST['save']) && !empty($_POST['data']['name'])) {
    pb_submit_check('data');
    $record = array();
    if (isset($_POST['id'])) {
        $id = intval($_POST['id']);
    }
    $record['name'] = $_POST['data']['name'];
    if (!empty($id)) {
        $record['modified'] = $time_stamp;
        unset($vals['created']);
        $result = $producttype->save($record, "update", $id, null, $conditions);
    } else {
        $orignal_count = $producttype->findCount(null, $conditions);
        if ($g['max_producttype'] && $orignal_count >= $g['max_producttype']) {
            flash("post_max");
        }
        $record['member_id'] = $the_memberid;
        $record['created'] = $record['modified'] = $time_stamp;
        $record['company_id'] = $company_id;
        $result = $producttype->save($record);
    }
    if (!$result) {
        flash();
    }
}
$result = $producttype->findAll('id,name', null, $conditions, " id DESC");
setvar("Items", $result);
vtemplate($tpl_file);
Esempio n. 2
0
require CACHE_PATH . 'cache_type.php';
check_permission("product");
$area = new Areas();
$industry = new Industries();
$productcategory = new Productcategories();
$page = new Pages();
$brand = new Brands();
$tag = new Tags();
$form = new Forms();
$product = new Products();
$producttype = new Producttypes();
$attachment = new Attachment('pic');
$conditions[] = "member_id = " . $the_memberid;
setvar("Countries", $countries = cache_read("country"));
setvar("ProductSorts", $_PB_CACHE['productsort']);
setvar("ProductTypes", $producttype->findAll('id,name', null, $conditions, "id DESC"));
setvar("Productcategories", $productcategory->getTypeOptions());
$tpl_file = "product";
if (!$company->Validate($companyinfo)) {
    flash("pls_complete_company_info", "company.php", 0);
}
if (isset($_POST['save'])) {
    $company->newCheckStatus($companyinfo['status']);
    if (!empty($_POST['data']['product'])) {
        $product->setParams();
        $now_product_amount = $product->findCount(null, "created>" . $today_start . " AND member_id=" . $the_memberid);
        $check_product_update = $g['product_check'];
        if ($check_product_update == 0) {
            $product->params['data']['product']['status'] = 1;
        } else {
            $product->params['data']['product']['status'] = 0;