Browse Source

Fix error message

Laurent Destailleur 6 years ago
parent
commit
5a1a6ac095
2 changed files with 12 additions and 3 deletions
  1. 11 2
      htdocs/comm/action/card.php
  2. 1 1
      htdocs/comm/action/class/actioncomm.class.php

+ 11 - 2
htdocs/comm/action/card.php

@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2018 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005      Simon TOSSER         <simon@kornog-computing.com>
  * Copyright (C) 2005-2017 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2010-2013 Juanjo Menent        <jmenent@2byte.es>
@@ -927,6 +927,15 @@ if ($action == 'create')
 if ($id > 0)
 {
 	$result1=$object->fetch($id);
+	if ($result1 <= 0)
+	{
+		$langs->load("errors");
+		print $langs->trans("ErrorRecordNotFound");
+
+		llxFooter();
+		exit;
+	}
+
 	$result2=$object->fetch_thirdparty();
 	$result2=$object->fetch_projet();
 	$result3=$object->fetch_contact();
@@ -957,7 +966,7 @@ if ($id > 0)
 		$object->note = GETPOST("note",'none');
 	}
 
-	if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
+	if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
 	{
 		dol_print_error($db,$object->error);
 		exit;

+ 1 - 1
htdocs/comm/action/class/actioncomm.class.php

@@ -620,7 +620,7 @@ class ActionComm extends CommonObject
                 $this->contact->id			= $obj->fk_contact;		// deprecated
 
                 $this->fk_element			= $obj->elementid;
-		$this->elementid			= $obj->elementid;
+                $this->elementid			= $obj->elementid;
                 $this->elementtype			= $obj->elementtype;
 
                 $this->fetchResources();