28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
44$langs->loadLangs(array(
"admin",
"errors",
"contracts"));
50$action =
GETPOST(
'action',
'aZ09');
51$value =
GETPOST(
'value',
'alpha');
52$modulepart =
GETPOST(
'modulepart',
'aZ09');
54$label =
GETPOST(
'label',
'alpha');
55$scandir =
GETPOST(
'scan_dir',
'alpha');
59 $conf->global->CONTRACT_ADDON =
'mod_contract_serpis';
67include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
71if ($action ==
'updateMask') {
72 $maskconst =
GETPOST(
'maskconstcontract',
'aZ09');
73 $maskvalue =
GETPOST(
'maskcontract',
'alpha');
75 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
84 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
86 setEventMessages($langs->trans(
"Error"),
null,
'errors');
88} elseif ($action ==
'specimen') {
89 $modele =
GETPOST(
'module',
'alpha');
92 $contract->initAsSpecimen();
97 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
98 foreach ($dirmodels as $reldir) {
99 $file =
dol_buildpath($reldir.
"core/modules/contract/doc/pdf_".$modele.
".modules.php", 0);
100 if (file_exists($file)) {
101 $classname =
"pdf_".$modele;
106 if ($classname !==
'') {
110 '@phan-var-force ModelePDFContract $module';
113 if (
$module->write_file($contract, $langs) > 0) {
114 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=contract&file=SPECIMEN.pdf");
121 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
122 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
124} elseif ($action ==
'set') {
127} elseif ($action ==
'del') {
134} elseif ($action ==
'setdoc') {
139 $conf->global->CONTRACT_ADDON_PDF = $value;
147} elseif ($action ==
'unsetdoc') {
149} elseif ($action ==
'setmod') {
154} elseif ($action ==
'set_other') {
155 $freetext =
GETPOST(
'CONTRACT_FREE_TEXT',
'restricthtml');
158 $draft =
GETPOST(
'CONTRACT_DRAFT_WATERMARK',
'alpha');
161 $value =
GETPOST(
'activate_hideClosedServiceByDefault',
'alpha');
162 $res3 =
dolibarr_set_const($db,
"CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value,
'chaine', 0,
'',
$conf->entity);
164 if (!($res1 > 0) || !($res2 > 0) || !($res3 > 0)) {
169 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
171 setEventMessages($langs->trans(
"Error"),
null,
'errors');
173} elseif ($action ==
"allowonlinesign") {
177} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
187 setEventMessages($langs->trans(
'Error'),
null,
'errors');
189 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
190 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
193} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
202 setEventMessages($langs->trans(
'Error'),
null,
'errors');
204 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
205 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
216$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
218llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-contract');
220$form =
new Form($db);
222$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
224print
load_fiche_titre($langs->trans(
"ContractsSetup"), $linkback,
'title_setup');
228print
dol_get_fiche_head($head,
'contract', $langs->trans(
"Contracts"), -1,
'contract');
235$contract->initAsSpecimen();
237printNumberingModuleList(
'contract',
'mod_contract_',
'CONTRACT_ADDON', $langs->trans(
"ContractsNumberingModules"), $contract);
245printDocumentModelList($type,
'contract',
'CONTRACT_ADDON_PDF', $langs->trans(
"TemplatePDFContracts"), array(
246 'Logo' =>
'option_logo',
247 'PaymentMode' =>
'option_modereg',
248 'PaymentConditions' =>
'option_condreg',
249 'MultiLanguage' =>
'option_multilang',
250 'WatermarkOnDraftOrders' =>
'option_draft_watermark',
251),
false,
'', 1,
'unsetdoc');
259print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
260print
'<input type="hidden" name="token" value="'.newToken().
'">';
261print
'<input type="hidden" name="action" value="set_other">';
265print
'<div class="div-table-responsive-no-min">';
266print
'<table class="noborder centpercent">';
267print
'<tr class="liste_titre">';
268print
'<td>'.$langs->trans(
"Parameter").
'</td>';
269print
'<td class="right"></td>';
273$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
274$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
275foreach ($substitutionarray as $key => $val) {
276 $htmltext .= $key.
'<br>';
280print
'<tr class="oddeven"><td colspan="2">';
281print $form->textwithpicto($langs->trans(
"FreeLegalTextOnContracts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'tooltiphelp');
283$variablename =
'CONTRACT_FREE_TEXT';
285 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
287 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
289 print $doleditor->Create();
291print
'</td></tr>'.
"\n";
295print
'<tr class="oddeven"><td>';
296print $form->textwithpicto($langs->trans(
"WatermarkOnDraftContractCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
297print
'</td><td class="right">';
298print
'<input class="flat minwidth200" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'CONTRACT_DRAFT_WATERMARK')).
'">';
299print
'</td></tr>'.
"\n";
301print
'<tr class="oddeven">';
302print
'<td>'.$langs->trans(
"HideClosedServiceByDefault").
'</td>';
303print
'<td class="right">';
304print $form->selectyesno(
"activate_hideClosedServiceByDefault",
getDolGlobalInt(
'CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT', 0), 1);
309print
'<tr class="oddeven">';
310print
'<td>'.$langs->trans(
"AllowOnlineSign").
'</td>';
311print
'<td class="right">';
312if (
$conf->use_javascript_ajax) {
313 print ajax_constantonoff(
'CONTRACT_ALLOW_ONLINESIGN', array(),
null, 0, 0, 0, 2, 0, 1,
'',
'',
'inline-block', 0, $langs->transnoentitiesnoconv(
"WarningOnlineSignature",
"https://www.dolistore.com"));
316 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=allowonlinesign&token='.
newToken().
'&value=0">';
317 print img_picto($langs->trans(
"Activated"),
'switch_on');
320 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=allowonlinesign&token='.
newToken().
'&value=1">';
321 print img_picto($langs->trans(
"Disabled"),
'switch_off');
329print
'<tr class="oddeven">';
330print
'<td>'.$langs->trans(
"AllowExternalDownload").
'</td>';
331print
'<td class="right">';
332print ajax_constantonoff(
'CONTRACT_ALLOW_EXTERNAL_DOWNLOAD', array(),
null, 0, 0, 0, 2, 0, 1);
338 print
'<tr class="oddeven">';
339 print
'<td>'.$langs->trans(
"SendReminderForExpiredServicesTitle").
'</td>';
340 print
'<td class="right">';
341 print
'<a href="'.DOL_URL_ROOT.
'cron/list.php?search_label=SendReminderForExpiredServicesTitle&status=-1">'.$langs->trans(
"ConfigureContractReminderCronjobToSetFrequency").
'</a>';
348print $form->buttonsSaveCancel(
"Save",
'');
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
if(! $sortfield) if(! $sortorder) $module
contract_admin_prepare_head()
Return array head with list of tabs to view object information.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.