From 48c8b470af2456cf6513fccbaefcc5524e46db80 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 1 Nov 2013 18:59:00 +0100 Subject: [PATCH] Add hook into product/document.php --- htdocs/product/document.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 0adff43ac47..0ba03e0c7c0 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Simon TOSSER + * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,6 +47,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('productdocuments')); + // Get parameters $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -68,6 +72,10 @@ if ($id > 0 || ! empty($ref)) } $modulepart='produit'; +$parameters=array('id'=>$id); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks + + /* * Action envoie fichier */ @@ -106,6 +114,8 @@ if ($object->id) $picto=($object->type==1?'service':'product'); dol_fiche_head($head, 'documents', $titre, 0, $picto); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);