NEW Support free bottom text and watermark on expense report template
This commit is contained in:
parent
ec99a056ac
commit
8419202588
@ -554,7 +554,6 @@ print "<br>";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Other options
|
* Other options
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||||
|
|||||||
@ -74,7 +74,9 @@ else if ($action == 'specimen') // For fiche inter
|
|||||||
|
|
||||||
$inter = new ExpenseReport($db);
|
$inter = new ExpenseReport($db);
|
||||||
$inter->initAsSpecimen();
|
$inter->initAsSpecimen();
|
||||||
|
$inter->status = 0; // Force statut draft to show watermark
|
||||||
|
$inter->fk_statut = 0; // Force statut draft to show watermark
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file=''; $classname=''; $filefound=0;
|
$file=''; $classname=''; $filefound=0;
|
||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
$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);
|
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
|
$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);
|
$res1 = 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')
|
|
||||||
{
|
|
||||||
$draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK','alpha');
|
$draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK','alpha');
|
||||||
|
$res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||||
$res = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
|
||||||
|
if (! $res1 > 0 || ! $res2 > 0) $error++;
|
||||||
if (! $res > 0) $error++;
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$db->commit();
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$db->rollback();
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -346,7 +336,7 @@ print '</table><br>';
|
|||||||
* Documents models for Interventions
|
* Documents models for Interventions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"));
|
print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', '');
|
||||||
|
|
||||||
// Defini tableau def des modeles
|
// Defini tableau def des modeles
|
||||||
$type='expensereport';
|
$type='expensereport';
|
||||||
@ -494,6 +484,58 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
print '</table>';
|
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();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -512,9 +512,9 @@ class pdf_standard extends ModeleExpenseReport
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Draft watermark
|
// Draft watermark
|
||||||
if ($object->fk_statut==1 && ! empty($conf->global->EXPENSEREPORT_FREE_TEXT))
|
if ($object->fk_statut == 0 && ! empty($conf->global->EXPENSEREPORT_DRAFT_WATERMARK))
|
||||||
{
|
{
|
||||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_FREE_TEXT);
|
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_DRAFT_WATERMARK);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
$pdf->SetTextColor(0,0,60);
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
var $fk_user_validator;
|
var $fk_user_validator;
|
||||||
var $status;
|
var $status;
|
||||||
var $fk_statut; // -- 1=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied
|
var $fk_statut; // -- 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied
|
||||||
var $fk_c_paiement;
|
var $fk_c_paiement;
|
||||||
var $paid;
|
var $paid;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user