diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php
index b9051f6f33a..25621a93e16 100644
--- a/htdocs/admin/agenda_other.php
+++ b/htdocs/admin/agenda_other.php
@@ -36,7 +36,11 @@ $langs->load("admin");
$langs->load("other");
$action = GETPOST('action','alpha');
+$value = GETPOST('value','alpha');
+$param = GETPOST('param','alpha');
$cancel = GETPOST('cancel','alpha');
+$scandir = GETPOST('scandir','alpha');
+$type = 'action';
/*
@@ -71,7 +75,21 @@ if (preg_match('/del_(.*)/',$action,$reg))
dol_print_error($db);
}
}
+// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
+if ($action == 'setModuleOptions')
+{
+ if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
if ($action == 'set')
{
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
@@ -79,6 +97,85 @@ if ($action == 'set')
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
}
+else if ($action == 'specimen') // For orders
+{
+ $modele=GETPOST('module','alpha');
+
+ $commande = new CommandeFournisseur($db);
+ $commande->initAsSpecimen();
+ $commande->thirdparty=$specimenthirdparty;
+
+ // Search template files
+ $file=''; $classname=''; $filefound=0;
+ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
+ foreach($dirmodels as $reldir)
+ {
+ $file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0);
+ if (file_exists($file))
+ {
+ $filefound=1;
+ $classname = "pdf_".$modele;
+ break;
+ }
+ }
+
+ if ($filefound)
+ {
+ require_once $file;
+
+ $module = new $classname($db,$commande);
+
+ if ($module->write_file($commande,$langs) > 0)
+ {
+ header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
+ return;
+ }
+ else
+ {
+ setEventMessages($module->error, $module->errors, 'errors');
+ dol_syslog($module->error, LOG_ERR);
+ }
+ }
+ else
+ {
+ setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
+ dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
+ }
+}
+
+// Activate a model
+else if ($action == 'setmodel')
+{
+ print "sssd".$value;
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+}
+
+else if ($action == 'del')
+{
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity);
+ }
+}
+
+// Set default model
+else if ($action == 'setdoc')
+{
+ if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
+ {
+ // La constante qui a ete lue en avant du nouveau set
+ // on passe donc par une variable pour avoir un affichage coherent
+ $conf->global->ACTION_EVENT_ADDON_PDF = $value;
+ }
+
+ // On active le modele
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+ }
+}
/**
@@ -86,7 +183,7 @@ if ($action == 'set')
*/
$formactions=new FormActions($db);
-
+$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader();
$linkback=''.$langs->trans("BackToModuleList").'';
@@ -95,14 +192,151 @@ print "
\n";
-print '