From eebf107d5fb984ca92906706495771c8b5f22ead Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 27 Oct 2014 10:54:50 +0100 Subject: [PATCH] includes and show_documents --- htdocs/comm/action/card.php | 50 ++++++++++++++++++----- htdocs/core/class/html.formfile.class.php | 7 ++++ 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 607f8e14c4e..33e470d1445 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -28,19 +28,20 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; +dol_include_once('/core/lib/agenda.lib.php'); +dol_include_once('/core/lib/date.lib.php'); +dol_include_once('/contact/class/contact.class.php'); +dol_include_once('/user/class/user.class.php'); +dol_include_once('/comm/action/class/cactioncomm.class.php'); +dol_include_once('/comm/action/class/actioncomm.class.php'); +dol_include_once('/core/class/html.formactions.class.php'); +dol_include_once('/core/class/html.formfile.class.php'); if (! empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + dol_include_once('/projet/class/project.class.php'); + dol_include_once('/core/class/html.formprojet.class.php'); } -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +dol_include_once('/core/class/extrafields.class.php'); $langs->load("companies"); $langs->load("commercial"); @@ -74,6 +75,7 @@ $cactioncomm = new CActionComm($db); $object = new ActionComm($db); $contact = new Contact($db); $extrafields = new ExtraFields($db); +$formfile = new FormFile($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); @@ -1243,6 +1245,34 @@ if ($id > 0) if ($action != 'edit') { + + if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) { + print '
'; + print ''; // ancre + + /* + * Documents generes + */ + + $filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + + $genallowed=$user->rights->agenda->myactions->create; + $delallowed=$user->rights->agenda->myactions->delete; + + $var=true; + + $somethingshown=$formfile->show_documents('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang); + + print '
'; + + + print '
'; + + print '
 
'; + } + + // Link to agenda views print '
'; print '
'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 674be61311d..2e316841696 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -301,6 +301,12 @@ class FormFile $modellist=ModeleThirdPartyDoc::liste_modeles($this->db); } } + + else if ($modulepart == 'agenda') + { + null; + } + else if ($modulepart == 'propal') { if (is_array($genallowed)) $modellist=$genallowed; @@ -433,6 +439,7 @@ class FormFile } else { + // For normalized standard modules $file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$modulepart.'.php',0); if (file_exists($file))