29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
38 $langs->loadLangs(array(
'admin',
'other',
'agenda',
'users'));
40 $action =
GETPOST(
'action',
'aZ09');
41 $value =
GETPOST(
'value',
'alpha');
42 $param =
GETPOST(
'param',
'alpha');
43 $cancel =
GETPOST(
'cancel',
'alpha');
44 $scandir =
GETPOST(
'scan_dir',
'alpha');
52 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
55 if (preg_match(
'/set_([a-z0-9_\-]+)/i', $action, $reg))
61 Header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
68 if (preg_match(
'/del_([a-z0-9_\-]+)/i', $action, $reg))
73 Header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
81 $getDefaultFilter =
GETPOST(
'AGENDA_DEFAULT_FILTER_TYPE');
82 $defaultfilter = (is_array($getDefaultFilter)) ? implode(
',', $getDefaultFilter) : $getDefaultFilter;
83 dolibarr_set_const($db,
'AGENDA_USE_EVENT_TYPE_DEFAULT',
GETPOST(
'AGENDA_USE_EVENT_TYPE_DEFAULT'),
'chaine', 0,
'', $conf->entity);
84 dolibarr_set_const($db,
'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter,
'chaine', 0,
'', $conf->entity);
85 dolibarr_set_const($db,
'AGENDA_DEFAULT_FILTER_STATUS',
GETPOST(
'AGENDA_DEFAULT_FILTER_STATUS'),
'chaine', 0,
'', $conf->entity);
87 } elseif ($action ==
'specimen')
89 $modele =
GETPOST(
'module',
'alpha');
92 $commande->initAsSpecimen();
93 $commande->thirdparty = $specimenthirdparty;
96 $file =
''; $classname =
''; $filefound = 0;
97 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
98 foreach ($dirmodels as $reldir)
100 $file =
dol_buildpath($reldir.
"core/modules/action/doc/pdf_".$modele.
".modules.php", 0);
101 if (file_exists($file))
104 $classname =
"pdf_".$modele;
113 $module =
new $classname($db, $commande);
115 if ($module->write_file($commande, $langs) > 0)
117 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=action&file=SPECIMEN.pdf");
125 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
130 elseif ($action ==
'setmodel')
134 } elseif ($action ==
'del')
139 if ($conf->global->ACTION_EVENT_ADDON_PDF ==
"$value")
dolibarr_del_const($db,
'ACTION_EVENT_ADDON_PDF', $conf->entity);
144 elseif ($action ==
'setdoc')
146 if (
dolibarr_set_const($db,
"ACTION_EVENT_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity))
150 $conf->global->ACTION_EVENT_ADDON_PDF = $value;
167 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
169 $wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
172 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
191 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
192 $sql .=
" WHERE type = 'action'";
193 $sql .=
" AND entity = ".$conf->entity;
195 $resql = $db->query($sql);
199 $num_rows = $db->num_rows(
$resql);
200 while ($i < $num_rows)
202 $array = $db->fetch_array(
$resql);
203 array_push($def, $array[0]);
210 if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
214 print '<table class="noborder centpercent">'.
"\n";
215 print '<tr class="liste_titre">'.
"\n";
216 print '<td width="100">'.$langs->trans(
"Name").
'</td>'.
"\n";
217 print '<td>'.$langs->trans(
"Description").
'</td>'.
"\n";
218 print '<td class="center" width="60">'.$langs->trans(
"Status").
'</td>'.
"\n";
219 print '<td class="center" width="60">'.$langs->trans(
"Default").
'</td>'.
"\n";
220 print '<td class="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
221 print '<td class="center" width="40">'.$langs->trans(
"Preview").
'</td>';
226 foreach ($dirmodels as $reldir)
232 $handle = opendir($dir);
233 if (is_resource($handle))
235 while (($file = readdir($handle)) !==
false)
237 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file))
239 $name = substr($file, 4,
dol_strlen($file) - 16);
240 $classname = substr($file, 0,
dol_strlen($file) - 12);
242 require_once $dir.
'/'.$file;
243 $module =
new $classname($db,
new ActionComm($db));
245 print '<tr class="oddeven">'.
"\n";
247 print (empty($module->name) ? $name : $module->name);
250 require_once $dir.
'/'.$file;
251 $module =
new $classname($db, $specimenthirdparty);
252 if (method_exists($module,
'info'))
253 print $module->info($langs);
254 else print $module->description;
258 if (in_array($name, $def))
260 print '<td class="center">'.
"\n";
261 if ($conf->global->ACTION_EVENT_ADDON_PDF !=
"$name")
263 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action">';
271 print '<td class="center">'.
"\n";
272 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
277 print '<td class="center">';
278 if ($conf->global->ACTION_EVENT_ADDON_PDF ==
"$name")
282 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'&type=action"" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
287 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
288 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
289 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
290 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
291 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
292 print '<td class="center">';
293 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
295 print '<td class="center">';
296 print '<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
306 print '</table><br>';
309 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" name="agenda">';
310 print '<input type="hidden" name="token" value="'.newToken().
'">';
311 print '<input type="hidden" name="action" value="set">';
313 print '<table class="noborder allwidth">'.
"\n";
314 print '<tr class="liste_titre">'.
"\n";
315 print '<td>'.$langs->trans(
"Parameters").
'</td>'.
"\n";
316 print '<td class="center"> </td>'.
"\n";
317 print '<td class="right">'.$langs->trans(
"Value").
'</td>'.
"\n";
322 print '<tr class="oddeven">'.
"\n";
323 print '<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE").
'</td>'.
"\n";
324 print '<td class="center"> </td>'.
"\n";
325 print '<td class="right">'.
"\n";
327 if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
329 print '<a href="'.$_SERVER[
'PHP_SELF'].
'?action=set_AGENDA_USE_EVENT_TYPE&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
331 print '<a href="'.$_SERVER[
'PHP_SELF'].
'?action=del_AGENDA_USE_EVENT_TYPE&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
333 print '</td></tr>'.
"\n";
336 print '<tr class="oddeven">'.
"\n";
337 $htmltext = $langs->trans(
"ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv(
"UserGUISetup"));
338 print '<td>'.$form->textwithpicto($langs->trans(
"AGENDA_DEFAULT_VIEW"), $htmltext).
'</td>'.
"\n";
339 print '<td class="center"> </td>'.
"\n";
340 print '<td class="right">'.
"\n";
341 $tmplist = array(
''=>
' ',
'show_list'=>$langs->trans(
"ViewList"),
'show_month'=>$langs->trans(
"ViewCal"),
'show_week'=>$langs->trans(
"ViewWeek"),
'show_day'=>$langs->trans(
"ViewDay"),
'show_peruser'=>$langs->trans(
"ViewPerUser"));
342 print $form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
343 print '</td></tr>'.
"\n";
345 if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
347 print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
348 print '<tr class="oddeven">'.
"\n";
349 print '<td>'.$langs->trans(
"AGENDA_USE_EVENT_TYPE_DEFAULT").
'</td>'.
"\n";
350 print '<td class="center"> </td>'.
"\n";
351 print '<td class="right nowrap">'.
"\n";
352 $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT,
"AGENDA_USE_EVENT_TYPE_DEFAULT",
'systemauto', 0, 1);
353 print '</td></tr>'.
"\n";
357 print '<tr class="oddeven">'.
"\n";
358 print '<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_TYPE").
'</td>'.
"\n";
359 print '<td class="center"> </td>'.
"\n";
360 print '<td class="right nowrap">'.
"\n";
362 if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) {
364 $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
366 $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE,
"AGENDA_DEFAULT_FILTER_TYPE",
'', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect);
367 print '</td></tr>'.
"\n";
371 print '<tr class="oddeven">'.
"\n";
372 print '<td>'.$langs->trans(
"AGENDA_DEFAULT_FILTER_STATUS").
'</td>'.
"\n";
373 print '<td class="center"> </td>'.
"\n";
374 print '<td class="right">'.
"\n";
375 $formactions->form_select_status_action(
'agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1,
'AGENDA_DEFAULT_FILTER_STATUS', 1, 2,
'minwidth100');
376 print '</td></tr>'.
"\n";
382 print '<div class="center"><input class="button button-save" type="submit" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'"></div>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
delDocumentModel($name, $type)
Delete document model used by doc generator.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Class to manage agenda events (actions)
agenda_prepare_head()
Prepare array with list of tabs.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
addDocumentModel($name, $type, $label= '', $description= '')
Add document model used by doc generator.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $wikihelp
View.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Class to manage predefined suppliers products.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.