Arreglat un bug de que no hi poden haver excepcions amb nom+preu iguals. default tip
authorviric@llimona
Thu, 31 May 2007 23:22:14 +0200
changeset 11 d5b5409fed69
parent 10 47746e0c30a3
Arreglat un bug de que no hi poden haver excepcions amb nom+preu iguals.
update-compra.php
--- a/update-compra.php	Wed Nov 08 23:03:52 2006 +0100
+++ b/update-compra.php	Thu May 31 23:22:14 2007 +0200
@@ -435,6 +435,22 @@
 		{
 			settype($_POST["epreu"][$i], "double");
 
+			/* El codi distingeix les excepcions per data+nom+preu.
+			   Per tant, no hi poden haver nom+preu iguals. */
+			for ($j = $i + 1; $j <= $_POST["num_excepcions"]; $j++)
+			{
+				if($_POST["earticle"][$i]
+					== $_POST["earticle"][$j] &&
+					$_POST["epreu"][$i]
+					== $_POST["epreu"][$j])
+				{
+					$error = "No hi poden haver "
+					       . "excepcions amb el mateix "
+					       . "nom i preu.";
+					return false;
+				}
+			}
+
 			if ($_POST["epreu"][$i] == 0)
 			{
 				$error = "Una excepció té preu 0.";