diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 18478551bfb..7393fe101e8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -50,7 +50,6 @@ abstract class CommonObject public $id; /** * @var string Error string - * @deprecated Use instead the array of error strings * @see errors */ public $error; diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index ea314688dbe..0dccd9fab13 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -67,6 +67,12 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + + +/******************************************************************* + * ACTIONS + ********************************************************************/ + $hookmanager->initHooks(array('resource', 'resource_card','globalcard')); $parameters=array('resource_id'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -74,9 +80,21 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - /******************************************************************* - * ACTIONS - ********************************************************************/ + if ($cancel) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + if ($action == 'add') + { + header("Location: ".DOL_URL_ROOT.'/resource/list.php'); + exit; + } + $action=''; + } + if ($action == 'add' && $user->rights->resource->write) { if (! $cancel) @@ -203,7 +221,7 @@ if (empty($reshook)) * * Put here all code to build page ****************************************************/ -$title = $langs->trans($action == 'create' ? 'AddResource' : 'ResourceCard'); +$title = $langs->trans($action == 'create' ? 'AddResource' : 'ResourceSingular'); llxHeader('',$title,''); $form = new Form($db); @@ -227,9 +245,8 @@ if ($action == 'create' || $object->fetch($id) > 0) if ( ! $user->rights->resource->write ) accessforbidden('',0); - /*--------------------------------------- - * Create/Edit object - */ + // Create/Edit object + print '