本文整理汇总了PHP中Supplier::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Supplier::create方法的具体用法?PHP Supplier::create怎么用?PHP Supplier::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier::create方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateProduct
function updateProduct($pro, $fileName, $line)
{
$clientScript = CatelogConnector::getConnector(B2BConnector::CONNECTOR_TYPE_CATELOG, getWSDL(), 'B2BUser', 'B2BUser');
try {
$transStarted = false;
try {
Dao::beginTransaction();
} catch (Exception $e) {
$transStarted = true;
}
$sku = trim($pro['sku']);
$product = Product::getBySku($pro['sku']);
$mageId = trim($pro['product_id']);
$name = trim($pro['name']);
$short_description = trim($pro['short_description']);
$description = trim($pro['description']);
$weight = trim($pro['weight']);
$statusId = trim($pro['status']);
$price = trim($pro['price']);
$specialPrice = trim($pro['special_price']);
$specialPrice_From = trim($pro['special_from_date']) === '' ? trim($pro['special_from_date']) : null;
$specialPrice_To = trim($pro['special_to_date']) === '' ? trim($pro['special_to_date']) : null;
$supplierName = trim($pro['supplier']);
$attributeSet = ProductAttributeSet::get(trim($pro['attributeSetId']));
if (!$product instanceof Product) {
$product = Product::create($sku, $name);
}
$asset = ($assetId = trim($product->getFullDescAssetId())) === '' || !($asset = Asset::getAsset($assetId)) instanceof Asset ? Asset::registerAsset('full_desc_' . $sku, $description, Asset::TYPE_PRODUCT_DEC) : $asset;
$product->setName($name)->setMageId($mageId)->setAttributeSet($attributeSet)->setShortDescription($short_description)->setFullDescAssetId(trim($asset->getAssetId()))->setIsFromB2B(true)->setStatus(ProductStatus::get($statusId))->setSellOnWeb(true)->setManufacturer($clientScript->getManufacturerName(trim($pro['manufacturer'])))->save()->clearAllPrice()->addPrice(ProductPriceType::get(ProductPriceType::ID_RRP), $price)->addInfo(ProductInfoType::ID_WEIGHT, $weight);
if ($specialPrice !== '') {
$product->addPrice(ProductPriceType::get(ProductPriceType::ID_CASUAL_SPECIAL), $specialPrice, $specialPrice_From, $specialPrice_To);
}
if ($supplierName !== '') {
$product->addSupplier(Supplier::create($supplierName, $supplierName, true));
}
if (isset($pro['categories']) && count($pro['categories']) > 0) {
$product->clearAllCategory();
foreach ($pro['categories'] as $cateMageId) {
if (!($category = ProductCategory::getByMageId($cateMageId)) instanceof ProductCategory) {
continue;
}
$product->addCategory($category);
}
}
if ($transStarted === false) {
Dao::commitTransaction();
}
//TODO remove the file
removeLineFromFile($fileName, $line);
echo $product->getId() . " => done! \n";
} catch (Exception $ex) {
if ($transStarted === false) {
Dao::rollbackTransaction();
}
throw $ex;
}
}
示例2: store
/**
* Store a newly created supplier in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Supplier::$rules);
if ($validator->fails()) {
return Redirect::back()->with('type', 'error')->withErrors($validator)->withInput();
}
Supplier::create($data);
return Redirect::route('admin.suppliers.index');
}
示例3: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$input = Input::all();
$data = array('supp_name' => $input['newSupName'], 'supp_type' => $input['newSupType'], 'supp_add' => $input['newSupAdd'], 'email' => $input['newSupEmail'], 'contact_f' => $input['newSupPhone'], 'contact_s' => $input['newSupPhone2'], 'supp_mgm' => $input['newSupMgm']);
$insert = Supplier::create($data);
if ($insert) {
return json_encode(array('error' => 0, 'success' => 1));
} else {
return json_encode(array('error' => 1, 'success' => 0));
}
}
示例4: run
public function run()
{
/*$faker = Faker::create();
foreach(range(1, 10) as $index)
{
Supplier::create([
]);
}*/
Supplier::create(['name' => '杨一', 'short_name' => 'YY', 'type' => 0, 'mobile' => '13588100379', 'telephone' => '', 'mail' => '', 'url' => '', 'qq' => '', 'wechat' => '', 'province' => 1, 'city' => 1, 'district' => 1, 'street' => '绍兴柯桥119当铺', 'address' => '绍兴柯桥119当铺', 'postcode' => '310022', 'acreage' => '', 'company' => '', 'amount' => '', 'output' => '', 'bank' => '', 'bank_address' => '', 'account_no' => '', 'account_name' => '', 'audit_status' => 2]);
Supplier::create(['name' => '杨二', 'short_name' => 'YE', 'type' => 0, 'mobile' => '13588100377', 'telephone' => '', 'mail' => '', 'url' => '', 'qq' => '', 'wechat' => '', 'province' => 1, 'city' => 1, 'district' => 1, 'street' => '绍兴柯桥117当铺', 'address' => '绍兴柯桥117当铺', 'postcode' => '310022', 'acreage' => '', 'company' => '', 'amount' => '', 'output' => '', 'bank' => '', 'bank_address' => '', 'account_no' => '', 'account_name' => '', 'audit_status' => 2]);
Supplier::create(['name' => '杨三', 'short_name' => 'YS', 'type' => 0, 'mobile' => '13588100378', 'telephone' => '', 'mail' => '', 'url' => '', 'qq' => '', 'wechat' => '', 'province' => 1, 'city' => 1, 'district' => 1, 'street' => '绍兴柯桥118当铺', 'address' => '绍兴柯桥118当铺', 'postcode' => '310022', 'acreage' => '', 'company' => '', 'amount' => '', 'output' => '', 'bank' => '', 'bank_address' => '', 'account_no' => '', 'account_name' => '', 'audit_status' => 2]);
Supplier::create(['name' => '杨学弟', 'short_name' => 'YXD', 'type' => 0, 'mobile' => '13588100375', 'telephone' => '', 'mail' => '', 'url' => '', 'qq' => '', 'wechat' => '', 'province' => 1, 'city' => 1, 'district' => 1, 'street' => '绍兴柯桥119当铺', 'address' => '绍兴柯桥119当铺', 'postcode' => '310022', 'acreage' => '', 'company' => '', 'amount' => '', 'output' => '', 'bank' => '', 'bank_address' => '', 'account_no' => '', 'account_name' => '', 'audit_status' => 2]);
Supplier::create(['name' => '冬雪敏', 'short_name' => 'DXM', 'type' => 0, 'mobile' => '13588100374', 'telephone' => '', 'mail' => '', 'url' => '', 'qq' => '', 'wechat' => '', 'province' => 1, 'city' => 1, 'district' => 1, 'street' => '绍兴柯桥117当铺', 'address' => '绍兴柯桥117当铺', 'postcode' => '310022', 'acreage' => '', 'company' => '', 'amount' => '', 'output' => '', 'bank' => '', 'bank_address' => '', 'account_no' => '', 'account_name' => '', 'audit_status' => 2]);
Supplier::create(['name' => '周小龙', 'short_name' => 'ZXL', 'type' => 0, 'mobile' => '13588100373', 'telephone' => '', 'mail' => '', 'url' => '', 'qq' => '', 'wechat' => '', 'province' => 1, 'city' => 1, 'district' => 1, 'street' => '绍兴柯桥118当铺', 'address' => '绍兴柯桥118当铺', 'postcode' => '310022', 'acreage' => '', 'company' => '', 'amount' => '', 'output' => '', 'bank' => '', 'bank_address' => '', 'account_no' => '', 'account_name' => '', 'audit_status' => 2]);
}
示例5: run
public function run()
{
/* Users table */
$usersData = array(array("username" => "administrator", "password" => Hash::make("password"), "email" => "admin@kblis.org", "name" => "kBLIS Administrator", "designation" => "Programmer"), array("username" => "external", "password" => Hash::make("password"), "email" => "admin@kblis.org", "name" => "External System User", "designation" => "Administrator", "image" => "/i/users/user-2.jpg"), array("username" => "lmorena", "password" => Hash::make("password"), "email" => "lmorena@kblis.org", "name" => "L. Morena", "designation" => "Lab Technologist", "image" => "/i/users/user-3.png"), array("username" => "abumeyang", "password" => Hash::make("password"), "email" => "abumeyang@kblis.org", "name" => "A. Abumeyang", "designation" => "Doctor"));
foreach ($usersData as $user) {
$users[] = User::create($user);
}
$this->command->info('users seeded');
/* Specimen Types table */
$specTypesData = array(array("name" => "Ascitic Tap"), array("name" => "Aspirate"), array("name" => "CSF"), array("name" => "Dried Blood Spot"), array("name" => "High Vaginal Swab"), array("name" => "Nasal Swab"), array("name" => "Plasma"), array("name" => "Plasma EDTA"), array("name" => "Pleural Tap"), array("name" => "Pus Swab"), array("name" => "Rectal Swab"), array("name" => "Semen"), array("name" => "Serum"), array("name" => "Skin"), array("name" => "Sputum"), array("name" => "Stool"), array("name" => "Synovial Fluid"), array("name" => "Throat Swab"), array("name" => "Urethral Smear"), array("name" => "Urine"), array("name" => "Vaginal Smear"), array("name" => "Water"), array("name" => "Whole Blood"));
foreach ($specTypesData as $specimenType) {
$specTypes[] = SpecimenType::create($specimenType);
}
$this->command->info('specimen_types seeded');
/* Test Categories table - These map on to the lab sections */
$test_categories = TestCategory::create(array("name" => "PARASITOLOGY", "description" => ""));
$lab_section_microbiology = TestCategory::create(array("name" => "MICROBIOLOGY", "description" => ""));
$this->command->info('test_categories seeded');
/* Measure Types */
$measureTypes = array(array("id" => "1", "name" => "Numeric Range"), array("id" => "2", "name" => "Alphanumeric Values"), array("id" => "3", "name" => "Autocomplete"), array("id" => "4", "name" => "Free Text"));
foreach ($measureTypes as $measureType) {
MeasureType::create($measureType);
}
$this->command->info('measure_types seeded');
/* Measures table */
$measureBSforMPS = Measure::create(array("measure_type_id" => "2", "name" => "BS for mps", "unit" => ""));
$measure1 = Measure::create(array("measure_type_id" => "2", "name" => "Grams stain", "unit" => ""));
$measure2 = Measure::create(array("measure_type_id" => "2", "name" => "SERUM AMYLASE", "unit" => ""));
$measure3 = Measure::create(array("measure_type_id" => "2", "name" => "calcium", "unit" => ""));
$measure4 = Measure::create(array("measure_type_id" => "2", "name" => "SGOT", "unit" => ""));
$measure5 = Measure::create(array("measure_type_id" => "2", "name" => "Indirect COOMBS test", "unit" => ""));
$measure6 = Measure::create(array("measure_type_id" => "2", "name" => "Direct COOMBS test", "unit" => ""));
$measure7 = Measure::create(array("measure_type_id" => "2", "name" => "Du test", "unit" => ""));
MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "No mps seen", "interpretation" => "Negative"));
MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "+", "interpretation" => "Positive"));
MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "++", "interpretation" => "Positive"));
MeasureRange::create(array("measure_id" => $measureBSforMPS->id, "alphanumeric" => "+++", "interpretation" => "Positive"));
MeasureRange::create(array("measure_id" => $measure1->id, "alphanumeric" => "Negative"));
MeasureRange::create(array("measure_id" => $measure1->id, "alphanumeric" => "Positive"));
MeasureRange::create(array("measure_id" => $measure2->id, "alphanumeric" => "Low"));
MeasureRange::create(array("measure_id" => $measure2->id, "alphanumeric" => "High"));
MeasureRange::create(array("measure_id" => $measure2->id, "alphanumeric" => "Normal"));
MeasureRange::create(array("measure_id" => $measure3->id, "alphanumeric" => "High"));
MeasureRange::create(array("measure_id" => $measure3->id, "alphanumeric" => "Low"));
MeasureRange::create(array("measure_id" => $measure3->id, "alphanumeric" => "Normal"));
MeasureRange::create(array("measure_id" => $measure4->id, "alphanumeric" => "High"));
MeasureRange::create(array("measure_id" => $measure4->id, "alphanumeric" => "Low"));
MeasureRange::create(array("measure_id" => $measure4->id, "alphanumeric" => "Normal"));
MeasureRange::create(array("measure_id" => $measure5->id, "alphanumeric" => "Positive"));
MeasureRange::create(array("measure_id" => $measure5->id, "alphanumeric" => "Negative"));
MeasureRange::create(array("measure_id" => $measure6->id, "alphanumeric" => "Positive"));
MeasureRange::create(array("measure_id" => $measure6->id, "alphanumeric" => "Negative"));
MeasureRange::create(array("measure_id" => $measure7->id, "alphanumeric" => "Positive"));
MeasureRange::create(array("measure_id" => $measure7->id, "alphanumeric" => "Negative"));
$measures = array(array("measure_type_id" => "1", "name" => "URIC ACID", "unit" => "mg/dl"), array("measure_type_id" => "4", "name" => "CSF for biochemistry", "unit" => ""), array("measure_type_id" => "4", "name" => "PSA", "unit" => ""), array("measure_type_id" => "1", "name" => "Total", "unit" => "mg/dl"), array("measure_type_id" => "1", "name" => "Alkaline Phosphate", "unit" => "u/l"), array("measure_type_id" => "1", "name" => "Direct", "unit" => "mg/dl"), array("measure_type_id" => "1", "name" => "Total Proteins", "unit" => ""), array("measure_type_id" => "4", "name" => "LFTS", "unit" => "NULL"), array("measure_type_id" => "1", "name" => "Chloride", "unit" => "mmol/l"), array("measure_type_id" => "1", "name" => "Potassium", "unit" => "mmol/l"), array("measure_type_id" => "1", "name" => "Sodium", "unit" => "mmol/l"), array("measure_type_id" => "4", "name" => "Electrolytes", "unit" => ""), array("measure_type_id" => "1", "name" => "Creatinine", "unit" => "mg/dl"), array("measure_type_id" => "1", "name" => "Urea", "unit" => "mg/dl"), array("measure_type_id" => "4", "name" => "RFTS", "unit" => ""), array("measure_type_id" => "4", "name" => "TFT", "unit" => ""));
foreach ($measures as $measure) {
Measure::create($measure);
}
$measureGXM = Measure::create(array("measure_type_id" => "4", "name" => "GXM", "unit" => ""));
$measureBG = Measure::create(array("measure_type_id" => "2", "name" => "Blood Grouping", "unit" => ""));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "O-"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "O+"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "A-"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "A+"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "B-"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "B+"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "AB-"));
MeasureRange::create(array("measure_id" => $measureBG->id, "alphanumeric" => "AB+"));
$measureHB = Measure::create(array("measure_type_id" => Measure::NUMERIC, "name" => "HB", "unit" => "g/dL"));
$measuresUrinalysisData = array(array("measure_type_id" => "4", "name" => "Urine microscopy", "unit" => ""), array("measure_type_id" => "4", "name" => "Pus cells", "unit" => ""), array("measure_type_id" => "4", "name" => "S. haematobium", "unit" => ""), array("measure_type_id" => "4", "name" => "T. vaginalis", "unit" => ""), array("measure_type_id" => "4", "name" => "Yeast cells", "unit" => ""), array("measure_type_id" => "4", "name" => "Red blood cells", "unit" => ""), array("measure_type_id" => "4", "name" => "Bacteria", "unit" => ""), array("measure_type_id" => "4", "name" => "Spermatozoa", "unit" => ""), array("measure_type_id" => "4", "name" => "Epithelial cells", "unit" => ""), array("measure_type_id" => "4", "name" => "ph", "unit" => ""), array("measure_type_id" => "4", "name" => "Urine chemistry", "unit" => ""), array("measure_type_id" => "4", "name" => "Glucose", "unit" => ""), array("measure_type_id" => "4", "name" => "Ketones", "unit" => ""), array("measure_type_id" => "4", "name" => "Proteins", "unit" => ""), array("measure_type_id" => "4", "name" => "Blood", "unit" => ""), array("measure_type_id" => "4", "name" => "Bilirubin", "unit" => ""), array("measure_type_id" => "4", "name" => "Urobilinogen Phenlpyruvic acid", "unit" => ""), array("measure_type_id" => "4", "name" => "pH", "unit" => ""));
foreach ($measuresUrinalysisData as $measureU) {
$measuresUrinalysis[] = Measure::create($measureU);
}
$measuresWBCData = array(array("measure_type_id" => Measure::NUMERIC, "name" => "WBC", "unit" => "x10³/µL"), array("measure_type_id" => Measure::NUMERIC, "name" => "Lym", "unit" => "L"), array("measure_type_id" => Measure::NUMERIC, "name" => "Mon", "unit" => "*"), array("measure_type_id" => Measure::NUMERIC, "name" => "Neu", "unit" => "*"), array("measure_type_id" => Measure::NUMERIC, "name" => "Eos", "unit" => ""), array("measure_type_id" => Measure::NUMERIC, "name" => "Baso", "unit" => ""));
foreach ($measuresWBCData as $value) {
$measuresWBC[] = Measure::create($value);
}
$measureRangesWBC = array(array("measure_id" => $measuresWBC[0]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 4, "range_upper" => 11), array("measure_id" => $measuresWBC[1]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 1.5, "range_upper" => 4), array("measure_id" => $measuresWBC[2]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 0.1, "range_upper" => 9), array("measure_id" => $measuresWBC[3]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 2.5, "range_upper" => 7), array("measure_id" => $measuresWBC[4]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 0, "range_upper" => 6), array("measure_id" => $measuresWBC[5]->id, "age_min" => 0, "age_max" => 100, "gender" => MeasureRange::BOTH, "range_lower" => 0, "range_upper" => 2));
foreach ($measureRangesWBC as $value) {
MeasureRange::create($value);
}
$this->command->info('measures seeded');
/* Test Types table */
$testTypeBS = TestType::create(array("name" => "BS for mps", "test_category_id" => $test_categories->id, "orderable_test" => 1));
$testTypeStoolCS = TestType::create(array("name" => "Stool for C/S", "test_category_id" => $lab_section_microbiology->id));
$testTypeGXM = TestType::create(array("name" => "GXM", "test_category_id" => $test_categories->id));
$testTypeHB = TestType::create(array("name" => "HB", "test_category_id" => $test_categories->id, "orderable_test" => 1));
$testTypeUrinalysis = TestType::create(array("name" => "Urinalysis", "test_category_id" => $test_categories->id));
$testTypeWBC = TestType::create(array("name" => "WBC", "test_category_id" => $test_categories->id));
$this->command->info('test_types seeded');
/* TestType Measure table */
TestTypeMeasure::create(array("test_type_id" => $testTypeBS->id, "measure_id" => $measureBSforMPS->id));
TestTypeMeasure::create(array("test_type_id" => $testTypeGXM->id, "measure_id" => $measureGXM->id));
TestTypeMeasure::create(array("test_type_id" => $testTypeGXM->id, "measure_id" => $measureBG->id));
TestTypeMeasure::create(array("test_type_id" => $testTypeHB->id, "measure_id" => $measureHB->id));
foreach ($measuresUrinalysis as $value) {
TestTypeMeasure::create(array("test_type_id" => $testTypeUrinalysis->id, "measure_id" => $value->id));
}
foreach ($measuresWBC as $value) {
TestTypeMeasure::create(array("test_type_id" => $testTypeWBC->id, "measure_id" => $value->id));
//.........这里部分代码省略.........
示例6: createSupp
public function createSupp()
{
$suppliers = Supplier::create(array('strSuppCompanyName' => Input::get('compName'), 'strSuppOwnerLName' => Input::get('suppLName'), 'strSuppOwnerFName' => Input::get('suppFName'), 'strSuppContactNo' => Input::get('contNumb'), 'strSuppAddress' => Input::get('suppAdd')));
//$suppliers->save();
return Redirect::to('/suppliers');
}
示例7:
<?php
//////////////////////////////////////////////////// AJAX /////////////////////////////////////////////////////////////////
if(isset($_POST['ajax_standart_window'])){
if($_POST['ajax_standart_window']=='create_supplier'){
$nickName = $_POST['nickName'];
$dop_info = $_POST['dop_info'];
$fullName = $_POST['fullName'];
if(Supplier::search_name($nickName)==0){
if(Supplier::search_name($fullName)==0){
echo '{
"response":"1",
"id":"'.Supplier::create($nickName,$fullName,$dop_info).'",
"text":"Данные успешно сохранены"
}';
}else{
echo '{
"response":"0",
"error":"2",
"text":"Название данной организации уже содержится в базе ОС"
}';
}
}else{
echo '{
"response":"0",
"error":"1",
"text":"Это сокращённое название уже содержится в базе ОС"
}';
}
exit;
}
}
示例8: User
<?php
require_once 'core/init.php';
if (Session::exists('success')) {
echo Session::flash('success');
}
$user = new User();
$x = escape($user->data()->name);
if (Input::exists()) {
//if(Token::check(Input::get('token'))) {
$supplier = new Supplier();
try {
$supplier->create(array('supplier_code' => Input::get('sup_code'), 'f_name' => Input::get('fname'), 'l_name' => Input::get('lname'), 'address_1' => Input::get('address1'), 'nic_no' => Input::get('nic'), 'mobile_no' => Input::get('mobile'), 'e_mail' => Input::get('email'), 'Gender' => Input::get('gender'), 'estate_name' => 'NULL', 'reg_no' => 'NULL', 'size_of_estate' => 'NULL', 'address_of_estate' => 'NULL', 'account_name' => Input::get('fname'), 'account_no' => 'NULL', 'bank' => 'HSBC', 'branch' => 'Deniyaya', 'last_edit_date' => date("Y-m-d H:i:s"), 'e_mail_send' => '0', 'sms_send' => '1', 'editor' => $x));
} catch (Exception $e) {
die($e->getMessage());
}
Session::flash('success');
Redirect::to('Supplier_registation.php?inserted');
}
include 'includes/head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<!-- Main Header -->
<?php
include 'top_nav.php';
?>
<!-- Left side column. contains the logo and sidebar -->
<?php
include 'includes/left_nav.php';
?>
示例9: search
public static function search($values = array())
{
$result1 = DB::getInstance()->search("supplier", $values);
if (count($result1) != 0) {
$result2 = DB::getInstance()->search("supplier_telephone", array("supplier_id" => $result1[0]["supplier_id"]));
$supplier_telephone = array();
for ($x = 0; $x < count($result2); $x++) {
$supplier_telephone[$x] = $result2[$x]["telephone"];
}
$supplier_data = array("id" => $result1[0]["supplier_id"], "company" => $result1[0]["supplier_name"], "email" => $result1[0]["supplier_email"], "street" => $result1[0]["supplier_address_line1"], "line2" => $result1[0]["supplier_address_line2"], "city" => $result1[0]["supplier_city"], "province" => $result1[0]["supplier_province"], "postal" => $result1[0]["supplier_postal"], "country" => $result1[0]["supplier_country"], "telephone" => $supplier_telephone);
$new_supplier = new Supplier();
$new_supplier->create($supplier_data);
return $new_supplier;
} else {
return null;
}
}
示例10: array
<?php
require_once 'core/init.php';
if (count($_POST) > 0) {
$supplier_data = array("company" => $_POST["company"], "email" => $_POST["email"], "street" => $_POST["street"], "line2" => $_POST["line2"], "city" => $_POST["city"], "province" => $_POST["province"], "postal" => $_POST["postal"], "country" => $_POST["country"], "telephone" => $_POST["links"]);
$_SESSION['form_data'] = $supplier_data;
header("Location: supplier_registration.php", true, 303);
die;
} else {
if (isset($_SESSION['form_data'])) {
$new_supplier = new Supplier();
print_r($_SESSION["form_data"]);
$new_supplier->create($_SESSION["form_data"]);
if ($new_supplier->register()) {
$message = "You have successfully Registered the Supplier !!";
echo "<script type='text/javascript'>alert('{$message}');</script>";
} else {
$message = "The Supplier Registration was unsuccessful.";
echo "<script type='text/javascript'>alert('{$message}');</script>";
}
unset($_SESSION["form_data"]);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Supplier Management</title>
示例11: User
require_once 'core/init.php';
if (Session::exists('success')) {
echo Session::flash('success');
}
$user = new User();
if ($user->isLoggedIn()) {
if (Input::exists()) {
//if(Token::check(Input::get('token'))) {
if (true) {
$validate = new Validation();
$validation = $validate->check($_POST, array('sup_code' => array('required' => true, 'min' => 3, 'max' => 4), 'fname' => array('required' => true, 'min' => 3, 'max' => 50)));
if ($validation->passed()) {
$supplier = new Supplier();
try {
$supplier->create(array('supplier_code' => Input::get('sup_code'), 'f_name' => Input::get('fname'), 'l_name' => Input::get('lname'), 'address_1' => Input::get('address1'), 'address_2' => Input::get('address2'), 'mobile_no' => Input::get('mobile'), 'e_mail' => Input::get('email'), 'Gender' => Input::get('gender'), 'last_edit_date' => date("Y-m-d H:i:s"), 'editor' => "no-editor-yet"));
} catch (Exception $e) {
die($e->getMessage());
}
Session::flash('success', 'You have successfully registered.');
Redirect::to('index.php');
} else {
pre($validation->errors());
}
}
}
}
?>
<form action="" method="post">
<table>
示例12: escape
<?php
require_once 'core/init.php';
if (Input::exists()) {
//if(Token::check(Input::get('token'))) {
if (true) {
$validate = new Validation();
$validation = $validate->check($_POST, array('nic' => array('required' => true, 'min' => 10, 'max' => 10), 'fname' => array('required' => true, 'min' => 3, 'max' => 50)));
if ($validation->passed()) {
$supplier = new Supplier();
try {
$supplier->create(array('supplier_code' => Input::get('sup_code'), 'f_name' => Input::get('fname'), 'l_name' => Input::get('lname'), 'address_1' => Input::get('address1'), 'address_2' => Input::get('address2'), 'nic_no' => Input::get('nic'), 'mobile_no' => Input::get('mobile'), 'phone_no' => Input::get('phone'), 'e_mail' => Input::get('email'), 'birth_day' => Input::get('birthday'), 'Gender' => Input::get('gender'), 'estate_name' => Input::get('estate_name'), 'reg_no' => Input::get('reg_no'), 'account_name' => Input::get('acc_name'), 'account_no' => Input::get('acc_no'), 'bank' => Input::get('bank'), 'branch' => Input::get('branch'), 'last_edit_date' => date("Y-m-d H:i:s"), 'editor' => "no-editor-yet"));
} catch (Exception $e) {
die($e->getMessage());
}
Session::flash('success', 'You have successfully registered.');
Redirect::to('index.php');
} else {
pre($validation->errors());
}
}
}
?>
<form action="" method="post">
<div class="field">
<label for="sup_code">Supplier Code</label>
<input type="text" name="sup_code" id="name" value="<?php
echo escape(Input::get('sup_code'));
?>
" autocomplete="off"/>
</div>
示例13: importProducts
/**
* import all products
*
* @return CatelogConnector
*/
public function importProducts()
{
if (!($systemSetting = SystemSettings::getByType(SystemSettings::TYPE_LAST_NEW_PRODUCT_PULL)) instanceof SystemSettings) {
throw new Exception('cannot get LAST_NEW_PRODUCT_PULL in system setting');
}
$fromDate = $systemSetting->getValue();
$products = $this->getProductList($fromDate);
if (count($products) === 0) {
echo 'nothing from magento. exitting' . "\n";
return $this;
}
try {
$transStarted = false;
try {
Dao::beginTransaction();
} catch (Exception $e) {
$transStarted = true;
}
foreach ($products as $pro) {
$mageId = trim($pro->product_id);
$sku = trim($pro->sku);
$pro = $this->getProductInfo($sku, $this->getInfoAttributes());
$created_at = trim($pro->created_at);
$updated_at = trim($pro->updated_at);
$product_id = trim($pro->product_id);
if (is_null($pro) || !isset($pro->additional_attributes)) {
continue;
}
// handle extra long sku from magento, exceeding mysql sku length limit
DaoMap::loadMap('Product');
$skuSizeLimit = DaoMap::$map['product']['sku']['size'];
if (strlen($sku) > $skuSizeLimit) {
echo 'Product ' . $sku . '(id=' . $product->getId() . ', magento Product Creation Time=' . trim($pro->created_at) . ') magento sku length exceed system sku length limit of' . $skuSizeLimit . ', skipped' . "\n";
continue;
}
$additionAttrs = $this->_getAttributeFromAdditionAttr($pro->additional_attributes);
$name = trim($additionAttrs['name']);
$short_description = trim($additionAttrs['short_description']);
$description = trim($additionAttrs['description']);
$weight = trim($additionAttrs['weight']);
$statusId = trim($additionAttrs['status']);
$price = trim($additionAttrs['price']);
$specialPrice = isset($additionAttrs['special_price']) ? trim($additionAttrs['special_price']) : '';
$specialPrice_From = isset($additionAttrs['special_from_date']) ? trim($additionAttrs['special_from_date']) : null;
$specialPrice_To = isset($additionAttrs['special_to_date']) ? trim($additionAttrs['special_to_date']) : null;
if (!($product = Product::getBySku($sku)) instanceof Product) {
$product = Product::create($sku, $name);
Log::logging(0, get_class($this), 'Found New Product from Magento with sku="' . trim($sku) . '" and name="' . $name . '", created_at="' . $created_at, self::LOG_TYPE, '', __FUNCTION__);
echo 'Found New Product from Magento with sku="' . trim($sku) . '" and name="' . $name . '", created_at="' . $created_at . ', updated_at' . $updated_at . "\n";
} elseif (Product::getBySku($sku) instanceof Product) {
$product = Product::getBySku($sku);
echo 'Found Existing Product from Magento with sku="' . trim($sku) . '" and name="' . $name . '", created_at="' . $created_at . ', updated_at' . $updated_at . '"' . "\n";
echo "\t" . 'Name: "' . $name . '"' . "\n";
echo "\t" . 'MageId: "' . $mageId . '"' . "\n";
echo "\t" . 'Short Description: "' . $short_description . '"' . "\n";
echo "\t" . 'Full Description: "' . $description . '"' . "\n";
echo "\t" . 'Status: "' . ProductStatus::get($statusId) . '"' . "\n";
echo "\t" . 'Manufacturer: id=' . $this->getManufacturerName(trim($additionAttrs['manufacturer']))->getId() . ', name="' . $this->getManufacturerName(trim($additionAttrs['manufacturer']))->getName() . '"' . "\n";
echo "\t" . 'Price: "' . $price . '"' . "\n";
echo "\t" . 'Weight: "' . $weight . '"' . "\n";
}
$asset = ($assetId = trim($product->getFullDescAssetId())) === '' || !($asset = Asset::getAsset($assetId)) instanceof Asset ? Asset::registerAsset('full_desc_' . $sku, $description, Asset::TYPE_PRODUCT_DEC) : $asset;
$product->setName($name)->setMageId($mageId)->setShortDescription($short_description)->setFullDescAssetId(trim($asset->getAssetId()))->setIsFromB2B(true)->setStatus(ProductStatus::get($statusId))->setSellOnWeb(true)->setManufacturer($this->getManufacturerName(trim($additionAttrs['manufacturer'])))->save()->clearAllPrice()->addPrice(ProductPriceType::get(ProductPriceType::ID_RRP), $price)->addInfo(ProductInfoType::ID_WEIGHT, $weight);
if ($specialPrice !== '') {
$product->addPrice(ProductPriceType::get(ProductPriceType::ID_CASUAL_SPECIAL), $specialPrice, $specialPrice_From, $specialPrice_To);
}
if (isset($additionAttrs['supplier']) && ($supplierName = trim($additionAttrs['supplier'])) !== '') {
$product->addSupplier(Supplier::create($supplierName, $supplierName, true));
}
if (isset($pro->categories) && count($pro->categories) > 0) {
$product->clearAllCategory();
foreach ($pro->category_ids as $cateMageId) {
if (!($category = ProductCategory::getByMageId($cateMageId)) instanceof ProductCategory) {
continue;
}
$product->addCategory($category);
}
}
}
$systemSetting->setValue($updated_at)->save();
if ($transStarted === false) {
Dao::commitTransaction();
}
} catch (Exception $ex) {
if ($transStarted === false) {
Dao::rollbackTransaction();
}
throw $ex;
}
return $this;
}
示例14: array
<?php
require_once 'core/init.php';
if (array_key_exists('links', $_POST)) {
$tel = $_POST['links'];
} else {
$tel = array();
}
$supplier_data = array("id" => null, "company" => $_POST["company"], "email" => $_POST["email"], "street" => $_POST["street"], "line2" => $_POST["line2"], "city" => $_POST["city"], "province" => $_POST["province"], "postal" => $_POST["postal"], "country" => $_POST["country"], "telephone" => $tel);
$new_supplier = new Supplier();
$new_supplier->create($supplier_data);
//print_r($new_supplier);
if ($new_supplier->register()) {
$message = "You have successfully Registered the Supplier !!";
$response = array("message" => $message, "sup_id" => DB::getInstance()->getLastId(), "sup_name" => $supplier_data['company']);
echo json_encode($response);
} else {
$message = "The Supplier Registration was unsuccessful.";
$response = array("message" => $message);
echo json_encode($response);
}