|
@@ -74,7 +74,9 @@ else if ($action == 'specimen') // For fiche inter
|
|
|
|
|
|
$inter = new ExpenseReport($db);
|
|
|
$inter->initAsSpecimen();
|
|
|
-
|
|
|
+ $inter->status = 0; // Force statut draft to show watermark
|
|
|
+ $inter->fk_statut = 0; // Force statut draft to show watermark
|
|
|
+
|
|
|
// Search template files
|
|
|
$file=''; $classname=''; $filefound=0;
|
|
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
|
@@ -187,43 +189,31 @@ else if ($action == 'setmod')
|
|
|
dolibarr_set_const($db, "EXPENSEREPORT_ADDON",$value,'chaine',0,'',$conf->entity);
|
|
|
}
|
|
|
|
|
|
-else if ($action == 'set_EXPENSEREPORT_FREE_TEXT')
|
|
|
+else if ($action == 'setoptions')
|
|
|
{
|
|
|
+ $db->begin();
|
|
|
+
|
|
|
$freetext= GETPOST('EXPENSEREPORT_FREE_TEXT'); // No alpha here, we want exact string
|
|
|
- $res = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
|
|
-
|
|
|
- if (! $res > 0) $error++;
|
|
|
-
|
|
|
- if (! $error)
|
|
|
- {
|
|
|
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-else if ($action == 'set_EXPENSEREPORT_DRAFT_WATERMARK')
|
|
|
-{
|
|
|
+ $res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
|
|
+
|
|
|
$draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK','alpha');
|
|
|
-
|
|
|
- $res = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
|
|
-
|
|
|
- if (! $res > 0) $error++;
|
|
|
+ $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
|
|
+
|
|
|
+ if (! $res1 > 0 || ! $res2 > 0) $error++;
|
|
|
|
|
|
if (! $error)
|
|
|
{
|
|
|
+ $db->commit();
|
|
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ $db->rollback();
|
|
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
* View
|
|
|
*/
|
|
@@ -346,7 +336,7 @@ print '</table><br>';
|
|
|
* Documents models for Interventions
|
|
|
*/
|
|
|
|
|
|
-print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"));
|
|
|
+print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', '');
|
|
|
|
|
|
// Defini tableau def des modeles
|
|
|
$type='expensereport';
|
|
@@ -494,6 +484,58 @@ foreach ($dirmodels as $reldir)
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
|
+
|
|
|
+print '<br>';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * Other options
|
|
|
+ */
|
|
|
+
|
|
|
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
|
|
+print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
+print '<input type="hidden" name="action" value="setoptions">';
|
|
|
+
|
|
|
+print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
|
|
+print '<table class="noborder" width="100%">';
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+print '<td>'.$langs->trans("Parameter").'</td>';
|
|
|
+print '<td align="center" width="60"></td>';
|
|
|
+print "</tr>\n";
|
|
|
+$var=true;
|
|
|
+
|
|
|
+$var=! $var;
|
|
|
+print '<tr '.$bc[$var].'><td colspan="2">';
|
|
|
+print $langs->trans("FreeLegalTextOnExpenseReports").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
|
|
+$variablename='EXPENSEREPORT_FREE_TEXT';
|
|
|
+if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
|
|
+{
|
|
|
+ print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
|
|
+}
|
|
|
+else
|
|
|
+{
|
|
|
+ include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|
|
+ $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details');
|
|
|
+ print $doleditor->Create();
|
|
|
+}
|
|
|
+print '</td></tr>'."\n";
|
|
|
+
|
|
|
+//Use draft Watermark
|
|
|
+$var=!$var;
|
|
|
+print '<tr '.$bc[$var].'><td colspan="2">';
|
|
|
+print $langs->trans("WatermarkOnDraftOrders").'<br>';
|
|
|
+print '<input size="50" class="flat" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
|
|
|
+print '</td></tr>'."\n";
|
|
|
+
|
|
|
+print '</table>';
|
|
|
+
|
|
|
+print '<div class="center">';
|
|
|
+print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
|
|
+print '</div>';
|
|
|
+
|
|
|
+print '</form>';
|
|
|
+
|
|
|
dol_fiche_end();
|
|
|
|
|
|
|