Assistent na nastaveni prirazky je nyni hezci a bezpecnejsi
authorThomas Mudrunka <tomas@mudrunka.cz>
Wed, 14 Dec 2011 04:29:11 +0000 (05:29 +0100)
committerThomas Mudrunka <tomas@mudrunka.cz>
Wed, 14 Dec 2011 04:29:11 +0000 (05:29 +0100)
assistants/set-margin.inc.php

index 90f8e1928edfcf03b48639169e530a5b81194b7b..76478342298205f5a60f5956eaa917ff359dcc86 100644 (file)
@@ -1,14 +1,17 @@
 <?php
 switch($SUBPATH[0]) {
        default: case 1:
-               echo $this->html->form("$URL/2", 'GET', array(
+               echo $this->html->form("$URL/2", 'POST', array(
                        array('margin','40','text',false,'autofocus','margin (%):'),
                        array(false,'SET-MARGIN','submit')
                ));
                break;
        case 2:
-               $margin = 1+($_GET['margin']/100);
-               $this->db->safe_query("UPDATE model SET model_price_out = CEIL(model_price_in * $margin)");
-               echo(T('Margin set to').' '.($margin*100-100).'%');
+               if(isset($_POST['margin'])) {
+                       $margin = 1+($_POST['margin']/100);
+                       $this->db->safe_query("UPDATE model SET model_price_out = CEIL(model_price_in * $margin)");
+                       $this->post_redirect_get("$URL_INTERNAL/1", T('Margin set to').' '.($margin*100-100).'%');
+               }
+               $this->post_redirect_get("$URL_INTERNAL/1","Set-margin: No value passed!", true);
                break;
 }
This page took 0.093856 seconds and 4 git commands to generate.