Exemplo n.º 1
0
 public function actionSaveGenBarcode()
 {
     $this->checkLogin();
     if (!empty($_POST)) {
         $barcodeConfig = BarcodeConfig::model()->find();
         if (empty($barcodeConfig)) {
             $barcodeConfig = new BarcodeConfig();
         }
         $barcodeConfig->barcode_width = Util::input($_POST['barcode_width']);
         $barcodeConfig->barcode_height = Util::input($_POST['barcode_height']);
         $barcodeConfig->cols = Util::input($_POST['columns']);
         $barcodeConfig->rows = Util::input($_POST['rows']);
         $barcodeConfig->font_size = Util::input($_POST['font_size']);
         $barcodeConfig->alignment = Util::input($_POST['text_alignment']);
         $barcodeConfig->paper = @Util::input($_POST['paper']);
         $barcodeConfig->a4_oriendtation = @Util::input($_POST['a4-oriendtation']);
         $barcodeConfig->a5_oriendtation = @Util::input($_POST['a5-oriendtation']);
         $barcodeConfig->paper_width = @Util::input($_POST['paper-width']);
         $barcodeConfig->paper_height = @Util::input($_POST['paper-height']);
         $barcodeConfig->paper_landscape = @Util::input($_POST['paper_landscape']);
         $barcodeConfig->barcode_rotate = @Util::input($_POST['barcode_rotate']);
         // show, hide
         $show_product_name = @Util::input($_POST['show_product_name']);
         $show_product_price = @Util::input($_POST['show_product_price']);
         $show_product_price_send = @Util::input($_POST['show_product_price_send']);
         if ($show_product_name == 'show') {
             $show_product_name = 'yes';
         } else {
             $show_product_name = 'no';
         }
         if ($show_product_price == 'show') {
             $show_product_price = 'yes';
         } else {
             $show_product_price = 'no';
         }
         if ($show_product_price_send == 'show') {
             $show_product_price_send = 'yes';
         }
         $barcodeConfig->show_product_name = $show_product_name;
         $barcodeConfig->show_product_price = $show_product_price;
         $barcodeConfig->show_product_price_send = $show_product_price_send;
         if ($barcodeConfig->save()) {
             echo 'success';
         }
     }
 }