35require
'../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/supplier_proposal.lib.php';
51$langs->loadLangs(array(
"admin",
"errors",
"other",
"supplier_proposal"));
57$action =
GETPOST(
'action',
'aZ09');
58$value =
GETPOST(
'value',
'alpha');
59$modulepart =
GETPOST(
'modulepart',
'aZ09');
61$label =
GETPOST(
'label',
'alpha');
62$scandir =
GETPOST(
'scan_dir',
'alpha');
63$type =
'supplier_proposal';
72include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
74if ($action ==
'updateMask') {
75 $maskconstsupplier_proposal =
GETPOST(
'maskconstsupplier_proposal',
'aZ09');
76 $masksupplier_proposal =
GETPOST(
'masksupplier_proposal',
'alpha');
80 if ($maskconstsupplier_proposal && preg_match(
'/_MASK$/', $maskconstsupplier_proposal)) {
81 $res =
dolibarr_set_const($db, $maskconstsupplier_proposal, $masksupplier_proposal,
'chaine', 0,
'',
$conf->entity);
89 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
91 setEventMessages($langs->trans(
"Error"),
null,
'errors');
95if ($action ==
'specimen') {
96 $modele =
GETPOST(
'module',
'alpha');
99 $supplier_proposal->initAsSpecimen();
104 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
105 foreach ($dirmodels as $reldir) {
106 $file =
dol_buildpath($reldir.
"core/modules/supplier_proposal/doc/pdf_".$modele.
".modules.php");
107 if (file_exists($file)) {
108 $classname =
"pdf_".$modele;
113 if ($classname !==
'') {
117 '@phan-var-force ModelePDFSupplierProposal $module';
119 if (
$module->write_file($supplier_proposal, $langs) > 0) {
120 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf");
123 setEventMessages(
$module->error,
null,
'errors');
127 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
128 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
132if ($action ==
'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK') {
133 $draft =
GETPOST(
'SUPPLIER_PROPOSAL_DRAFT_WATERMARK',
'alpha');
135 $res =
dolibarr_set_const($db,
"SUPPLIER_PROPOSAL_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'',
$conf->entity);
141 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
143 setEventMessages($langs->trans(
"Error"),
null,
'errors');
147if ($action ==
'set_SUPPLIER_PROPOSAL_FREE_TEXT') {
148 $freetext =
GETPOST(
'SUPPLIER_PROPOSAL_FREE_TEXT',
'restricthtml');
157 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
159 setEventMessages($langs->trans(
"Error"),
null,
'errors');
163if ($action ==
'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL') {
164 $res =
dolibarr_set_const($db,
"BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value,
'chaine', 0,
'',
$conf->entity);
171 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
173 setEventMessages($langs->trans(
"Error"),
null,
'errors');
179if ($action ==
'set') {
181} elseif ($action ==
'del') {
188} elseif ($action ==
'setdoc') {
189 dolibarr_set_const($db,
"SUPPLIER_PROPOSAL_ADDON_PDF", empty($value) ?
'' : $value,
'chaine', 0,
'',
$conf->entity);
196} elseif ($action ==
'setmod') {
201} elseif (preg_match(
'/set_(.*)/', $action, $reg)) {
203 if ($code ==
"SUPPLIER_PROPOSAL_FREE_TEXT") {
204 $value = (
GETPOST($code,
'restricthtml') ?
GETPOST($code,
'restricthtml') : 1);
214 setEventMessages($langs->trans(
'Error'),
null,
'errors');
216 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
217 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
220} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
229 setEventMessages($langs->trans(
'Error'),
null,
'errors');
231 setEventMessages($langs->trans(
'SetupSaved'),
null,
'mesgs');
232 header(
"Location: " . $_SERVER[
"PHP_SELF"]);
242$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
245llxHeader(
'', $langs->trans(
"SupplierProposalSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-supplier_proposal');
247$form =
new Form($db);
249$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>';
251print
load_fiche_titre($langs->trans(
"SupplierProposalSetup"), $linkback,
'title_setup');
255print
dol_get_fiche_head($head,
'general', $langs->trans(
"CommRequests"), -1,
'supplier_proposal');
261$supplier_proposal->initAsSpecimen();
263printNumberingModuleList(
'supplier_proposal',
'mod_supplier_proposal_',
'SUPPLIER_PROPOSAL_ADDON', $langs->trans(
"SupplierProposalNumberingModules"), $supplier_proposal);
277$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
278$sql .=
" WHERE type = '".$db->escape($type).
"'";
279$sql .=
" AND entity = ".((int)
$conf->entity);
280$resql = $db->query($sql);
283 $num_rows = $db->num_rows($resql);
284 while ($i < $num_rows) {
285 $array = $db->fetch_array($resql);
286 if (is_array($array)) {
287 array_push($def, $array[0]);
292 dol_print_error($db);
296print
"<table class=\"noborder\" width=\"100%\">\n";
297print
"<tr class=\"liste_titre\">\n";
298print
" <td>".$langs->trans(
"Name").
"</td>\n";
299print
" <td>".$langs->trans(
"Description").
"</td>\n";
300print
'<td align="center" width="40">'.$langs->trans(
"Status").
"</td>\n";
301print
'<td align="center" width="40">'.$langs->trans(
"Default").
"</td>\n";
302print
'<td align="center" width="40">'.$langs->trans(
"ShortInfo").
'</td>';
303print
'<td align="center" width="40">'.$langs->trans(
"Preview").
'</td>';
308foreach ($dirmodels as $reldir) {
309 foreach (array(
'',
'/doc') as $valdir) {
310 $realpath = $reldir.
"core/modules/supplier_proposal".$valdir;
314 $handle = opendir($dir);
315 if (is_resource($handle)) {
317 while (($file = readdir($handle)) !==
false) {
323 foreach ($filelist as $file) {
324 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
325 if (file_exists($dir.
'/'.$file)) {
329 require_once $dir.
'/'.$file;
331 '@phan-var-force CommonDocGenerator $module';
333 $modulequalified = 1;
335 $modulequalified = 0;
338 $modulequalified = 0;
341 if ($modulequalified) {
342 print
'<tr class="oddeven"><td width="100">';
345 if (method_exists(
$module,
'info')) {
353 if (in_array($name, $def)) {
354 print
'<td class="center">'.
"\n";
355 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
356 print img_picto($langs->trans(
"Enabled"),
'switch_on');
360 print
'<td align="center">'.
"\n";
361 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
366 print
'<td align="center">';
368 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value=0&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'" alt="'.$langs->trans(
"Default").
'">'.img_picto($langs->trans(
"Default"),
'on').
'</a>';
370 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode(
$module->scandir).
'&label='.urlencode(
$module->name).
'" alt="'.$langs->trans(
"Disabled").
'">'.img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
375 $htmltooltip =
''.$langs->trans(
"Name").
': '.
$module->name;
376 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.(
$module->type ?
$module->type : $langs->trans(
"Unknown"));
378 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.
$module->page_largeur.
'/'.
$module->page_hauteur;
380 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
382 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
383 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.yn(
$module->option_logo, 1, 1);
384 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.yn(
$module->option_modereg, 1, 1);
385 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.yn(
$module->option_condreg, 1, 1);
386 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.yn(
$module->option_multilang, 1, 1);
389 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftProposal").
': '.yn(
$module->option_draft_watermark, 1, 1);
392 print
'<td class="center">';
393 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
397 print
'<td class="center">';
399 print
'<a href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'specimen',
'module' => $name],
true).
'">'.img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
401 print img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
425print
"<table class=\"noborder\" width=\"100%\">";
426print
"<tr class=\"liste_titre\">";
427print
"<td>".$langs->trans(
"Parameter").
"</td>\n";
428print
'<td></td>'.
"\n";
429print
"<td> </td>\n";
433$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
434$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
435foreach ($substitutionarray as $key => $val) {
436 $htmltext .= $key.
'<br>';
440print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
441print
'<input type="hidden" name="token" value="'.newToken().
'">';
442print
'<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
443print
'<tr class="oddeven"><td colspan="2">';
444print $form->textwithpicto($langs->trans(
"FreeLegalTextOnSupplierProposal"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
445$variablename =
'SUPPLIER_PROPOSAL_FREE_TEXT';
447 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
449 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
451 print $doleditor->Create();
453print
'</td><td class="right">';
454print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
459print
"<form method=\"post\" action=\"".$_SERVER[
"PHP_SELF"].
"\">";
460print
'<input type="hidden" name="token" value="'.newToken().
'">';
461print
"<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
462print
'<tr class="oddeven"><td>';
463print $form->textwithpicto($langs->trans(
"WatermarkOnDraftProposal"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
465print
'<input class="flat minwidth200" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'SUPPLIER_PROPOSAL_DRAFT_WATERMARK')).
'">';
466print
'</td><td class="right">';
467print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
472 print
'<tr class="oddeven"><td>';
473 print $langs->trans(
"BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").
'</td><td>';
474 print ajax_constantonoff(
'BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');
479 print
'<tr class="oddeven"><td>';
480 print $langs->trans(
"BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").
'</td><td> </td><td align="center">'.$langs->trans(
'NotAvailable').
'</td></tr>';
484print
'<tr class="oddeven">';
485print
'<td>'.$langs->trans(
"AllowExternalDownload").
'</td>';
487print ajax_constantonoff(
'PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(),
null, 0, 0, 0, 2, 0, 1);
493print
'<tr class="oddeven">';
494print
'<td>'.img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"Notifications").
'</td>';
495print
'<td colspan="2">';
496print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification");
500print
'<tr class="oddeven">';
501print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
502print
'<td colspan="2">';
503print img_picto(
'',
'url',
'class="pictofixedwidth"').
'<a href="'.DOL_URL_ROOT.
'/admin/pdf_other.php">'.$langs->trans(
"SeeInPDFSetupPage").
'</a>';
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.
Class to manage price ask supplier.
if(! $sortfield) if(! $sortorder) $module
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
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.
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).
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
supplier_proposal_admin_prepare_head()
Return array head with list of tabs to view object information.